macros

How do make C++ create an expression that uses compile-time checking for constants and asserts for variables?

Here’s an example setup… a macro or a template CHECKEXPR_RETURNVAL(EXPR,VAL) that checks that EXPR is TRUE while returning VAL. This is useful in a variety of places -- like in this highly simplified example: #define ISPOW2(VAL) ((0!=VAL)&&(0==(VAL&(VAL-1)))) #define _ALIGNPOW2(VAL,ALIGN) ((VAL+(ALIGN-1))&(~(ALIGN-1))) #defi...

What is the macro definition of isupper in C?

I want to know how the "isupper" macro is defined in C/C++. Could you please provide me the same or point me to available resources. I tried looking at ctype.h but couldnt figure it out. ...

Hotkey for moving messages from inbox to archive in Outlook

I'd like to configure a hotkey, in MS Outlook, which does the following to the highlighted/selected messages: Mark as read (by default it's [crtl]+Q) Move to an "archive" folder (archive meaning a folder other than the default inbox) This should happen whenever I press [crtl]+M (assuming it is not already reserved), on any amount of ...

Question about a wrapper macro function

I was reading the jemalloc's realloc function and noticed that all the non-static functions(at least the ones I've seen) in jemalloc is wrapped with JEMALLOC_P macro and JEMALLOC_P is: #define JEMALLOC_P(s) s Why would they need such a thing? ...

ActiveX control tab order in an Excel spreadsheet - is it possible to access/control this from script?

I have embedded a number of ActiveX controls in an Excel 2007 spreadsheet. Is there a way from VBA code to access the tab order assigned to a control so that the controls can be tabbed through in a particular order? The ActiveX controls I have inserted tab through in the insertion order, but this is not correct after changes have been ma...

How can I make a macro recorder/player with pyHook in Python?

I want to make a little script that, when pressed some specific key, for example F2, the macro starts to record the mouse actions, only the location of the click, and then play it when pressed another specific key... Could someone give me a little example of what I have to do? ...

How do I write a Clojure macro to create a regular expression from a String?

I'm creating a convenience macro. Part of the convenience is that a regular expression can be specified with just a String, rather than the #"re" notation. The one part I can't figure out is how to get the macro to take the String and rewrite it as a Clojure regex (e.g., produce the #"re" notation). I think it's a syntax / escaping prob...

Why to undefine macros before define them?

#undef GOOGLE_LONGLONG #undef GOOGLE_ULONGLONG #undef GOOGLE_LL_FORMAT #ifdef _MSC_VER #define GOOGLE_LONGLONG(x) x##I64 #define GOOGLE_ULONGLONG(x) x##UI64 #define GOOGLE_LL_FORMAT "I64" // As in printf("%I64d", ...) #else #define GOOGLE_LONGLONG(x) x##LL #define GOOGLE_ULONGLONG(x) x##ULL #define GOOGLE_LL_FORMAT "ll" // As in "%lld...

How does Excel's FREQUENCY function work?

With the following function: =FREQUENCY(C2:C724,D2:D37) The second parameter is the BIN What I don't understand is why Excel would increment the BIN for the rest of your values. The BIN does not change! It stays the same bin. Yet when I paste the formula for all my values it does this: =FREQUENCY(C2:C724,D2:D37) =FREQUENCY(C2:C724,D...

Start without debugging

In Visual Studio 2010, is there any way to start a non-StartUp Project without debugging? Of course I mean without changing the solution settings (i.e. assume there is a StartUp project, which is the one I want to start 90% of the time) I'll take a macro if someone knows how to write it. Thanks ...

C++ begin and end of function macros

Hi, I'm trying to write two simple macros for begin and end of functions in order to manage and log all the Exceptions in my program. In other words, I wanna have a try-catch block in all of my functions. in simple case consider the following macros. #define __BEGIN_FUNCTION__ try { #define __END_FUNCTION__ } catch(std::exception e) \...

MIN and MAX in C

Where are MIN and MAX defined in C, if at all? What is the best way to implement these, as generically and type safe as possible (compiler extensions/builtins for mainstream compilers preferred). ...

macros - complex formula

hi, I have the following excel formulae in different columns: = IF( OR(D2 <1000, D2 = 1000),"5","") = IF( AND(OR(D2 <10000, D2 = 10000 ), D2 >1000),"4","") = IF(AND(OR(D2 > 10000, D2 = 100000), D2 < 100000), "3","") = IF(AND(OR(D2 > 100000,D2 = 100000), D2 < 1000000),"2","") = IF(OR(D2 > 1000000,D4 = 1000000),"1","") so total 5 ...

XSL macros - how to create a macro that will replace "call-template" - "with-param" code

Hello, I'm trying to find a solution for how to replace standard 3-line code of type "call-template" - "with-param" with one single line. For example I have the following piece of code: <xsl:call-template name="do_job"> <xsl:with-param name="str">data1</xsl:with-param> </xsl:call-template> that i want to replace with something li...

Learning C: strange code, what does it do?

I'm exploring wxWidgets and at the same time learning C/C++. Often wxWidgets functions expect a wxString rather than a string, therefore wxWidgets provides a macro wxT(yourString) for creating wxStrings. My question concerns the expansion of this macro. If you type wxT("banana") the expanded macro reads L"banana". What meaning does t...

Find/Replace Using C++ Macro?

I have a case where I'm using a macro to generate simple subclasses. I've currently got it defined as: #define REGISTER( TYPE, NAME ) \ struct NAME ## Class : public ParentClass \ { \ NAME ## Class () : ParentClass ( # NAME ); \ } I really want t...

VC++ 6.0 MFC - Problem using Macro defined in <WINSER.H>

Hello there, I am facing a weird problem. I have got a file called in which I am using a macro called "WM_USER", the macro is defined in another header file called . Now the problem is that when I am using the macro in the compiler doesn't recognize it. Its not the case that I haven't included , because earlier I wasn't having any prob...

Excel macro Auto start only in XLT file and not in XLS file.

I am using and XLT that contains macros, it creates an XLS by open, and save it in a choosen directory, the problem is, the saved file contains the same macros as the XLT. Is there any chance to modify the proc to make it save the generated file without the macros? best regards, Thomas ...

Access Report Size Uncontrollable!!!

Hi all, I have a report in Access 2007 that is opened by pressing a button on a form. This button triggers an OpenReport macro, where the report is told to open in Print Preview view, and Dialog window mode. How can I manually set the size of this window, along with the opening zoom level? In the properties of the report, both AutoResi...

How big can a malloc be in C?

I have a malloc in C that is 26901^2*sizeof(double) This got me thinking what the largest value can be here? Also, would I have any problems defining a macro to access this 2D array? #define DN(i,j) ((int)i * ny + (int)j) Because this seems to not be working for me - or I am at least unsure it is. I can't figure out how to make to...