This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Compiler V2.40a #pragma warning disable = 329 doesn't work

Using the below pragma

#pragma warning disable = 329
does not suppress warning 329.

The warning is:
warning C329: single-line comment contains line-continuation

  • Interesting - but you will just fix your code, won't you...?

  • Probably not. The lines that the compiler's complaining about are comments. These particular comments are in a file that converts raw A/D values into meaningful sensor values, and are ASCII text drawings of the sensor circuitry. For example, consider this type of comment block:

        //                 |\ X1 AMP
        //                 |     //             +---|  +---[TP]
        //             |   | /
        //             |   |/
    

    that's attempting to show that a unity gain op amp buffers the signal before it goes to the A/D input.

    I thought that everything after the '//' comment was supposed to be ignored.

  • Boy... that didn't show up in the forum that way it looked when I pasted it into my reply! Can't seem to get the forum to display leading spaces in front of my primitive drawing char's, whether I use the pre /pre markers or not.

    The bottom line is that I have a comment of the '//' type, and the compiler's not ignoring everything after that comment identifier.

    Programs I write using Microsoft Visual C++ don't complain during the build process when I end a '//' comment with the '\' character, even when I have the compiler set to complain about anything and everything.

  • First off, a side remark: why use single-line comments for a half-page block comment?

    I thought that everything after the '//' comment was supposed to be ignored.

    Well, almost, but not quite everything. The technical details set aside, suffice it to say that processing of backslash-linebreak line continuation is done by the preprocessor before it interprets comment characters. I.e.

    //int foo = 42;
    
    does not define 'foo', because the whole snippet is just a single comment.

    Given that

    * it's considerably more likely that this happened by accident than on purpose
    * such an accident can hide valid code from the compiler, and
    * it's never actually necessary to do it like that

    I'd say the warning is justified, and shouldn't be turned off. So the fact that turning it off didn't work is a positive feature ;->

  • The forum software turned this:

    //int foo = 42;
    
    into
    // int foo = 42;

    but only on the actual article --- doesn't happen in the preview! IOW the forum is performing the same transformation on the posted text that we're discussing about. ;-P

  • Your points are well taken. Without getting into a philosophical debate about coding styles, etc., the bottom line is that I'm just trying to foster continuous improvement of the tools and report what looks like a bug to me.

  • In the meantime you'll probably find that wrapping the whole block in a
    #if 0
    #endif
    will get rid of the warning.

  • "Without getting into a philosophical debate about coding styles, etc"

    I think you deserve significant Brownie points for your endevours in documenting your code!

    Could you not just use the conventional /*...*/ comments, though?

  • Of course, and I have done so. The warnings that I could not disable via the pragma have been eliminated via /* */ style comment blocks instead, as suggested.

    As I stated earlier... I'm just trying to give some feedback to the KEIL team so that they can improve their product when and if they so desire. I know this is not a "big deal". Nonetheless, sometimes looking into the cause of a bug can yield insights into previously unknown problems that may be significantly more important.

    To me, it's always better to have ALL bugs reported, rather than just the ones that someone may think are important or worthwhile at some time.