System.out.println function syntax in C++

As larsmans already pointed out, java has overloads on the operator +. So you can concat strings with integer. This is also possible in C++ but not out of the box for all types. You could use a templated functions like this. But I would recommend to take a look at boost::format. I guess this library … Read more

What is the return type of sizeof operator?

C++11, §5.3.3 ¶6 The result of sizeof and sizeof… is a constant of type std::size_t. [ Note: std::size_t is defined in the standard header (18.2). — end note ] You can also do a quick check: which correctly outputs 1 on my machine. As @Adam D. Ruppe said in the comment, probably the compiler does not complain because, since it already knows the result, … Read more

Using OpenMP with clang

Update Building the latest trunk of LLVM/Clang (clang-3.8), installing libiomp5, and specifying the location of the gomp omp header files worked. Note that the Ubuntu package for libiomp5 isn’t quite correct, so you will need to add a symlink in /usr/lib from /usr/lib/libiomp5.so to /usr/lib/libiomp5.so.5. I’m using g++-5.1 and clang++-3.6 on Linux Mint 17.2 (essentially … Read more

What does ** mean in C++?

There is no specific ** operator in C++, instead it’s two separate asterisks, and asterisks in a declaration denotes pointer declaration. So in the declaration the argument head is declared to be a pointer to a pointer to IntElement.

Is there a C++ equivalent to getcwd?

Ok, I’m answering even though you already have accepted an answer. An even better way than to wrap the getcwd call would be to use boost::filesystem, where you get a path object from the current_path() function. The Boost filesystem library allows you to do lots of other useful stuff that you would otherwise need to … Read more

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