I just learned about the new C++ draft standard N4604.
I read Section 16.8 “Predefined macro names” and created this little test program to assess the compilers available: Continue reading C++ draft standard N4604
I got my copy of “Programming — Principles and Practice Using C++”, second edition, today. My copy is of the third printing, dated June 2015, so it’s a pretty recent printing.
I’m not teaching programming nor C++ at my school, although I used to. My job is simply to be the school’s system administrator, but the odd guest lecture and other lecture invitations has popped up from time to time over the past 16 years. I’ve known C++ since 1994, and the language and its libraries has changed at lot over the years. Maybe Prof. Dr. Stroustrup’s teaching style will have an impact on my own teaching style. Continue reading Programming — Principles and Practice Using C++, 2nd edition
If you’re looking for a way to detect when your code is being compiled by clang, try the command
clang -dM -E -x c /dev/null
In the large list presented, you’ll find these macros the most interesting ones:
#define __clang__ 1 #define __clang_major__ 3 #define __clang_minor__ 3 #define __clang_patchlevel__ 0 #define __clang_version__ "3.3 (tags/RELEASE_33/final 183502)" #define __llvm__ 1 #define __GNUC__ 4 #define __GNUC_MINOR__ 2 #define __GNUC_PATCHLEVEL__ 1 #define __VERSION__ "4.2.1 Compatible FreeBSD Clang 3.3 (tags/RELEASE_33/final 183502)"
clang is a breath of fresh air when it comes to deliver meaningful diagnostic of errors in program code. Not only is the diagnostic colourful on screen, clang also points out where in the source file changes ought to be made.