pure/const function attributes in different compilers

GCC: pure/const function attributes llvm-gcc: supports the GCC pure/const attributes Clang: seems to support it (I tried on a simple example with the GCC style attributes and it worked.) ICC: seems to adopt the GCC attributes (Sorry, only a forum post.) MSVC: Seems not to support it. (discussion) In general, it seems that almost all … Read more

declaring a const instance of a class

Your class is a POD (essentially because it doesn’t provide a default constructor). POD variables are not initialized upon declaration. That is, this: foo x; does not initialize x to a meaningful value. This has to be done separately. Now, when you declare it as const, this may never happen because you cannot assign to … Read more

Declaring a hex constant in VB.NET

C# uses 0x and VB.NET uses &H as the prefix to specify hexadecimal numbers. try this. Public Const temp As Integer = &HE6359A60 Sub Main End Sub And it could be as Uint also: Public Const temp As UInt32 = &HE6359A60UI Sub Main End Sub Check MSDN’s Type Characters (Visual Basic) documentation for defining hexadecimal … Read more

Get int, float, boolean and string from Properties

If you have a class of configuration values, like your Constants class, and you want to load all values from a configuration (properties) file, you can create a little helper class and use reflection: public class ConfigLoader { public static void load(Class<?> configClass, String file) { try { Properties props = new Properties(); try (FileInputStream … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)