Compiler Pragmas We'd Like To See

#pragma expiration(date)

Refuse to compile the following code after the specified date.

#pragma moran(email address)

Emails the specified address every time there is a compilation error in any code that follows.

#pragma tricky

Tells the optimizer to go easy on the next bit.

#pragma borken

Tells the compiler to do its worst; it hardly matters, the code is busted anyway.

#pragma stfu

Tells the compiler to shut up and compile. That’s your job, and that’s it. Your job is not to announce banners about compiler versions, or display company logos in blinking text, or declare with amazement (and a full line of “!!!!!!!!!” marks) that the compilation has finished with 0 errors, 0 warnings, 0 flatulent events, and 0 animals harmed.

#pragma blame(username)

If there are errors in the following code, arrange with the source code control system to blame it on some other checkin made by the specified user.

#pragma whew

Dear reader, take a break, you have earned it.

#pragma notme

This design was someone else’s idea, not mine. Don’t blame me.

#pragma myway

If I were to do it, I’d write it this way. I feel like a total moron doing it that other way, but nobody listens and nobody appears to care. (Implementation-dependent side effect: The code is enabled when the project is cancelled).

This entry was posted in Rantage. Bookmark the permalink.

5 Responses to Compiler Pragmas We'd Like To See

  1. andhapp says:

    Lol…funny and creative. I would like to add to the list when compiler can analyse the code and rate the programmers. For example:

    “You are better than Programmer B but worse than Programmer K.”

    That would be amusing!

  2. DGentry says:

    I think #pragma myway should be an if/else conditional, and hooked into the HR database. Which version gets compiled depends on who is still at the company. If both parties leave it automatically becomes a #error until someone else steps up.

  3. Anonymous says:

    #pragma expiration(date) exists already, in the form of #if DATE_AS_INT(__DATE__) > … #error “I’m expired” #endif. Consult the comp.lang.c archives for the definition of the DATE_AS_INT macro.

    #pragma moran(address) can be done with a SVN hook, and usually is.

    #pragma stfu is of course equivalent to “>/dev/null”.

    No comment on the obvious joke entries.

  4. James Cheap says:

    #pragma nocash

    invoked during last 3 weeks of a startup’s life

  5. Sol_HSA says:

    I actually do this on some projects: =)

    (if _MSC_VER is defined)
    #define STFU(x) warning(disable: x)

    Examples of use:

    #pragma STFU(4514) // unreferenced inline function removed
    #pragma STFU(4100) // unreferenced formal parameter

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>