Skip to content

Instantly share code, notes, and snippets.

@trentpolack
Last active July 18, 2019 19:13
Show Gist options
  • Save trentpolack/957daf8f0189e8d0ef5da4e75ac68d04 to your computer and use it in GitHub Desktop.
Save trentpolack/957daf8f0189e8d0ef5da4e75ac68d04 to your computer and use it in GitHub Desktop.
Old-School #pragma Messages to Yourself

The Ol' #pragma Message

For particularly necessary to-do reminders, the JM_TODO macro below will print to the build console (and on the warning/error list) as a trivial warning -- so it won't interfere with builds that treat warnings as errrors. Then you can just double-click it and jump to that spot.

jmtodo-in-action

The Code

#define JM_PRAGMA_STRING2(x) #x
#define JM_PRAGMA_STRING(x) JM_PRAGMA_STRING2(x)

#define JM_TODO( date_text, todo_text ) __pragma( message( __FILE__ "(" JM_PRAGMA_STRING(__LINE__) "): warning : TODO (" date_text "): " todo_text ) )
@cupsster
Copy link

Ohh this one is nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment