Jump to content
Sign in to follow this  
hollie

Preprocessor Directive #warn

Recommended Posts

Hello,

 

when debugging my code, I use a preprocessor directive 'DEBUG' that I define at the command line using the '-d' option.

 

I can then in my code skip certain sections that are hard to simulate, e.g. waiting for the completion of a serial transmission of the hardware UART unit in a PIC.

 

Would it be possible to add a preporcessor directive '#warn' that prints its argument to the output pane? It would do exactly the same as the #error directive, but it should not cause a compilation error.

 

In this way I could add a code statement like this:

 

#ifdef DEBUG
#warn "Debugging is enabled, certain code sections will be skipped!"
#endif

 

This way, it would be harder to 'forget' that the debugging directive is enabled, and thus loading code that won't work in your target device.

 

Kind regards,

Hollie.

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...