macros

C++: Convert Macro based Property System to use templates

I've already implemented, using macros, a C++ property system that satisfied the following requirements: Property can be referenced using a integeral key Property can be accessed via a generic Set/Get Properties (and property keys) must be inheritable Properties can be registered with getters/setters and is implemented as follows E...

How to debug macros efficiently in VS?

Hello, I've got a pretty complicated macro inside my (unmanaged) C++ code. Is there any way to expand macros in VS debugger? Or maybe there is another way to debug macros there? F.e. I'd like to place a breakpoint inside it. (Yes, I know macros are bad.) ...

How to tame the Windows headers (useful defines)?

In one of the answers to this question jalf spoke about useful define NOMINMAX, that could prevent from unwanted defining min/max macros. Are there other useful defines that can help to control windows.h (or other Windows headers, for instance Microsoft C Runtime headers or STL implementation) behavior? ...

How to tag text in emacs

I'm developing a text annotation system in emacs, where the format of the annotation is something like this. If this is the text: Lorem ipsem por favor I need to annotate it like this: {latin}Lorem imsem{/latin} {spanish}por favor{/spanish} So what I want to do is select a region and then run a function or a macro that will prompt...

C: Effective Macro Usage

#ifndef MACROS_NULLCHECK_H_ #define MACROS_NULLCHECK_H_ #include <assert.h> #define NULLCHECK(x) assert(x != (void *) 0); #endif If I used the above style as a template for declaring Macros, what provisos would you have? ...

How do I tell if a C integer variable is signed?

As an exercise, I'd like to write a macro which tells me if an integer variable is signed. This is what I have so far and I get the results I expect if I try this on a char variable with gcc -fsigned-char or -funsigned-char. #define ISVARSIGNED(V) (V = -1, (V < 0) ? 1 : 0) Is this portable? Is there a way to do this without destro...

using #include to load opencl code

i've seen this done long ago with hlsl/glsl shader code. using a #include on the source code file that pastes the code into a char* so that no file io happens at runtime. if i were to represent it as pseudo-code it would look a little like this: #define CLSourceToString(filename) " #include "filename" " const char* kernel = CLSourceToS...

how to create a macro in EXCEL that will print a Word Document without opeining it.

hi, i have a document mydocument.docx i want to print that from a button in excel sheet. both are in same folder. i don't want users to see word document.They just click the button in excel and printing of word file starts. this is actually very urgent. and i am totally new to this so if u can explain this in steps that would be so awe...

How do I read hex numbers and iterate in an Excel macro?

I have an excel sheet and on column J, I have a start number and on column K I have a end number... I want to write a macro that will read the start number in hex and print all the number including the number in between starting in column L. This is what I have: ..........J...K.....L...M....N..O .........1A...1C .........2B...2B I w...

A C preprocessor macro to pack bitfields into a byte?

I'm getting into microcontroller hacking and while I'm very comfortable with bitwise operators and talking right to the hardware, I'm finding the resulting code very verbose and boilerplate. The higher level programmer in me wants to find an effective but efficient way to clean it up. For instance, there's a lot of setting flags in reg...

Xcode/GCC predefined macro for target name?

I was wondering if there is an Xcode or GCC preprocessor symbol for the target name of the application. For example if I'm building an application called "MonkeyChicken", is there a preprocessor symbol such that printf( __TARGET_NAME__ ) outputs: MonkeyChicken ...

Getting wildcards to work in find and replace function in VBA macro for Microsoft Word

Hello all! Thanks in advance for your help! I have a VBA macro for Microsoft Word that I am trying to improve. The purpose of the macro is to bold and italicize all words in a document that match the search terms in the first table of the document. The problem is the search terms include wildcards which are the following: the hy...

distinguishing between static and non-static methods in c++ at compile time?

For some tracing automation for identifying instances i want to call either: a non-static method of the containing object returning its identifier something else which always returns the same id My current solution is to have a base class with a method which() and a global function which() which should be used if not in the context o...

sas macro index or other?

I have 169 towns for which I want to iterate a macro. I need the output files to be saved using the town-name (rather than a town-code). I have a dataset (TOWN) with town-code and town-name. Is it possible to have a %let statement that is set to the town-name for each iteration where i=town-code? I know that I can list out the town-...

Set debugging macro conditionally with make

In my C++ project, I have a convention where whenever the macro DEBUG is defined, debugging printf-esque statements are compiled into the executable. To indicate whether or not I want these compiled into the executable, I normally would pass the macro name to gcc with the -Dmacro option. So, in the Makefile I (currently) have: CXXFLAG...

C# for writing macros in Visual Studio?

Hi, I started C# a while ago and really like it. I work with VS 2008 and really like it. I tried Resharper and loved it. Now I am starting with Macros in VS2008 to increase my coding speed a little more. And stumble upon visual basic. And I do not like that. Is there any way to write macros in C#. Or a workaround, in writing a plugi...

Excel: how to start macro recording from OLE

I control Excel instance via OLE and I want to start macro recording. Can I do that via code? The only thing I've found is Application.RecordMacro and it doesn't do what I need. ...

Delete a macro in Notepad++

I have a macro in Notepad++ that I don't use anymore, the macro also uses a shortcut I want to use for other macro's. But there seems to be no function in Notepad++ to delete macro's. Is there a more difficult way to delete macro's in Notepad++ (for instance manipulating the setting-files of Notepad++)? ...

Legit Uses of the offsetof Macro in C / C++

There is this macro offsetof in C/C++ which allows you to get the address offset of a member in a POD structure. For an example from the C FAQ: struct foo { int a; int b; }; struct foo; /* Set the b member of foo indirectly */ *(int *)((char *)foo + offsetof(b)) = 0xDEADBEEF; Now this just seems evil to me and I can't see many legi...

error C3867: function call missing argument list

I'm upgrading a game engine's source code from Visual Studio 2003 to Visual Studio 2008. When I try and compile the source code I get the following error. error C3867: 'UObject::StaticConstructor': function call missing argument list; use '&UObject::StaticConstructor' to create a pointer to member in the following code: //----(IMP...