__FILE__ macro shows full path
The standard predefined macro __FILE__ available in C shows the full path to the file. Is there any way to short the path? I mean instead of /full/path/to/file.c I see to/file.c or file.c 30 Answers 30
The standard predefined macro __FILE__ available in C shows the full path to the file. Is there any way to short the path? I mean instead of /full/path/to/file.c I see to/file.c or file.c 30 Answers 30
Does anyone know how to properly save/reuse macros recorded inside of a vim editor? 6 Answers 6
Apparently macros were dropped from Visual Studio 2012. Is there a plugin/extension/tool that will let me record & play keyboard macros (much like the record/play temporary macro in Visual Studio 2010)? For example, I typically would use a macro when converting code from one language to another or to quickly generate properties from a text list, etc. 10 Answers … Read more
This question already has answers here: Closed 12 years ago. Possible Duplicates: What’s the use of do while(0) when we define a macro? Why are there sometimes meaningless do/while and if/else statements in C/C++ macros? do { … } while (0) what is it good for? I’ve seen some multi-line C macros that are wrapped … Read more
I have two macros FOO2 and FOO3: #define FOO2(x,y) … #define FOO3(x,y,z) … I want to define a new macro FOO as follows: #define FOO(x,y) FOO2(x,y) #define FOO(x,y,z) FOO3(x,y,z) But this doesn’t work because macros do not overload on number of arguments. Without modifying FOO2 and FOO3, is there some way to define a macro … Read more
Sorry for asking very basic question. I would like to set OR condition in #ifdef directive.? How to do that ? I tried #ifdef LINUX | ANDROID … .. #endif It did not work? What is the proper way? 2 Answers 2
I have seen the following macro definitions in a coding book. #define TRUE “https://stackoverflow.com/”/”https://stackoverflow.com/” #define FALSE ‘-‘-‘-‘ There was no explanation there. Please explain to me how these will work as TRUE and FALSE. 6 Answers 6
Reading Paul Graham’s essays on programming languages one would think that Lisp macros are the only way to go. As a busy developer, working on other platforms, I have not had the privilege of using Lisp macros. As someone who wants to understand the buzz, please explain what makes this feature so powerful. Please also … Read more
I bumped into this strange macro code in /usr/include/linux/kernel.h: /* Force a compilation error if condition is true, but also produce a result (of value 0 and type size_t), so the expression can be used e.g. in a structure initializer (or where-ever else comma expressions aren’t permitted). */ #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) #define … Read more