What’s the significance of a C function declaration in parentheses apparently forever calling itself?

The function name g_atomic_int_compare_and_exchange_full is in parentheses. What’s the significance of this? Putting a function name in brackets avoids any macro expansion in case there is a function like macro with the same name. That means, g_atomic_int_compare_and_exchange_full(…) will use the macro while (g_atomic_int_compare_and_exchange_full)(…) will use the function. Why is this used? You cannot assign a … Read more

How and When to Use @async and @sync in Julia

According to the documentation under ?@async, “@async wraps an expression in a Task.” What this means is that for whatever falls within its scope, Julia will start this task running but then proceed to whatever comes next in the script without waiting for the task to complete. Thus, for instance, without the macro you will … Read more

how to find the source of some macros

A simple, quick way to find out where a macro has been defined is to redefine the macro and check compiler’s Warning/Error message. #include <windows.h> #define min(a,b) nonsense mintest.cpp(3) : warning C4005: ‘min’ : macro redefinition C:\Programme\Microsoft SDKs\Windows\v6.0A\include\windef.h(194) : see previous definition of ‘min’

What is the __STDC_VERSION__ value for C11?

With -std=c11 in gcc, 201112L is used for __STDC_VERSION__ See this gcc patch on December 20, 2011 on gcc ml: https://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg23572.html And note that apparently the ISO version of C11 forgot to update the 201ymmL from the Draft. The intended final __STDC_VERSION__ value, 201112L, is also implemented (the editor forgot to update the 201ymmL placeholders … Read more

Examples of what Lisp’s macros can be used for

Source code transformations. All kinds. Examples: New control flow statements: You need a WHILE statement? Your language doesn’t have one? Why wait for the benevolent dictator to maybe add one next year. Write it yourself. In five minutes. Shorter code: You need twenty class declarations that almost look identical – only a limited amount of … Read more

What is the difference between a preprocessor macro with no arguments, and one with zero arguments

Replacement only occurrs for a function-like macro if the macro name is followed by a left parenthesis. So, the following all invoke the function-like macro MY_MACRO(): MY_MACRO() MY_MACRO ( ) MY_MACRO ( ) But this would not: MY_MACRO SomethingElse It depends on how you are using the macro and what it is used for as … Read more

What useful macros have you created in Netbeans? [closed]

Here is a list of macro codes with short explanations. Might be useful for someone. Update: replaced old link with one to the Netbeans site and included the macro list in here. abbrev-debug-line Debug Filename and Line Number adjust-caret-bottom Move Insertion Point to Bottom adjust-caret-center Move Insertion Point to Center adjust-caret-top Move Insertion Point to … Read more

Is there a way to both check a macro is defined and it equals a certain value at the same time

This may not work for the general case (I don’t think there’s a general solution to what you’re asking for), but for your specific example you might consider changing this sequence of code: #if(DEBUG_PRINT == 1) printf(“%s”, “Testing”); #endif to: if (DEBUG_PRINT == 1) { printf(“%s”, “Testing”); } It’s no more verbose and will fail … Read more

What do __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS mean?

__STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS are a workaround to allow C++ programs to use stdint.h macros specified in the C99 standard that aren’t in the C++ standard. The macros, such as UINT8_MAX, INT64_MIN, and INT32_C() may be defined already in C++ applications in other ways. To allow the user to decide if they want the macros defined … Read more

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