lcc-win32 conformance question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • teapot

    lcc-win32 conformance question


    If I compile this program

    int main(void)
    {
    return 0; // foo bar baz
    }

    with

    "lc -A -ansi89 foo.c"

    (minus the quotes), no diagnostic is produced; but isn't this style of
    comment illegal in C89 and thus this piece of code should be invalid?

    How standards conformant is (unnamed compiler)?

  • Ian Collins

    #2
    Re: lcc-win32 conformance question

    teapot wrote:
    If I compile this program
    >
    int main(void)
    {
    return 0; // foo bar baz
    }
    >
    with
    >
    "lc -A -ansi89 foo.c"
    >
    (minus the quotes), no diagnostic is produced; but isn't this style of
    comment illegal in C89 and thus this piece of code should be invalid?
    >
    How standards conformant is (unnamed compiler)?
    >
    Why are you asking on a C++ group?

    --
    Ian Collins.

    Comment

    • Ian Collins

      #3
      Re: lcc-win32 conformance question

      Ian Collins wrote:
      teapot wrote:
      >If I compile this program
      >>
      >int main(void)
      >{
      > return 0; // foo bar baz
      >}
      >>
      >with
      >>
      > "lc -A -ansi89 foo.c"
      >>
      >(minus the quotes), no diagnostic is produced; but isn't this style of
      >comment illegal in C89 and thus this piece of code should be invalid?
      >>
      >How standards conformant is (unnamed compiler)?
      >>
      Why are you asking on a C++ group?
      >
      Oops, I buggered that up, wrong group open...

      --
      Ian Collins.

      Comment

      • Bartc

        #4
        Re: lcc-win32 conformance question


        "teapot" <tea@pot.invali dwrote in message
        news:1910893.vo mING923G@aioe.o rg...
        >
        If I compile this program
        >
        int main(void)
        {
        return 0; // foo bar baz
        }
        >
        with
        >
        "lc -A -ansi89 foo.c"
        >
        (minus the quotes), no diagnostic is produced; but isn't this style of
        comment illegal in C89 and thus this piece of code should be invalid?
        >
        How standards conformant is (unnamed compiler)?
        You mean, the unnamed compiler called lcc-win32?

        Well, I couldn't get an error message from it. Neither from using
        DigitalMars DMC -A.

        GCC of course complained, but then with it's 10000 options it would be odd
        if it missed that one.

        Sorry I didn't have any more command-line compilers to try..

        I guess some are strictly conformant are some aren't. Perhaps there should
        be a certificate issued to conformant ones to stop you absentmindedly
        sneaking in a // comment or two!

        --
        bartc



        Comment

        • Ben Bacarisse

          #5
          Re: lcc-win32 conformance question

          teapot <tea@pot.invali dwrites:
          If I compile this program
          >
          int main(void)
          {
          return 0; // foo bar baz
          }
          >
          with
          >
          "lc -A -ansi89 foo.c"
          >
          (minus the quotes), no diagnostic is produced; but isn't this style of
          comment illegal in C89 and thus this piece of code should be invalid?
          If the compiler claims conformance to the obvious standard when passed
          that flag then it is in error. Of course, just passing flag means
          nothing. Does the documentation claim conformance to C90 (= ANSI C89)?
          How standards conformant is (unnamed compiler)?
          Do you mean lcc-win32? If so, I have found problems with compound
          literals, VLA parameters, complex numbers and designated initialisers
          so some of the C99 parts are a bit rough round the edges. There have
          been a few other reports of conformance issues, but they may well have
          been fixed. For example, it used to consider long * and int * to be
          compatible types.

          It is probably fair to say the standards conformance is not a top
          priority for that compiler.

          --
          Ben.

          Comment

          • jacob navia

            #6
            Re: lcc-win32 conformance question

            Ian Collins wrote:
            teapot wrote:
            >If I compile this program
            >>
            >int main(void)
            >{
            > return 0; // foo bar baz
            >}
            >>
            >with
            >>
            > "lc -A -ansi89 foo.c"
            >>
            >(minus the quotes), no diagnostic is produced; but isn't this style of
            >comment illegal in C89 and thus this piece of code should be invalid?
            >>
            >How standards conformant is (unnamed compiler)?
            >>
            Why are you asking on a C++ group?
            >
            Because pissing lcc-win is his favorite spot, like my cat
            that pisses everywhere even in my computer!



            --
            jacob navia
            jacob at jacob point remcomp point fr
            logiciels/informatique

            Comment

            • santosh

              #7
              Re: lcc-win32 conformance question

              jacob navia wrote:
              Ian Collins wrote:
              >teapot wrote:
              >>If I compile this program
              >>>
              >>int main(void)
              >>{
              >> return 0; // foo bar baz
              >>}
              >>>
              >>with
              >>>
              >> "lc -A -ansi89 foo.c"
              >>>
              >>(minus the quotes), no diagnostic is produced; but isn't this style
              >>of comment illegal in C89 and thus this piece of code should be
              >>invalid?
              >>>
              >>How standards conformant is (unnamed compiler)?
              >>>
              >Why are you asking on a C++ group?
              >>
              >
              Because pissing lcc-win is his favorite spot, like my cat
              that pisses everywhere even in my computer!
              In any case is what the OP claims true? Are there command-line switches
              to get a diagnostic for C++ style comments when compiler in strict C90
              mode?

              PS. I think you should cool down a little and not give these anonymous
              posters much weightage (except if they do uncover a real issue in
              lcc-win). Even your prose has started suffering.

              Comment

              • Serve Laurijssen

                #8
                Re: lcc-win32 conformance question


                "teapot" <tea@pot.invali dschreef in bericht
                news:1910893.vo mING923G@aioe.o rg...
                >
                If I compile this program
                >
                int main(void)
                {
                return 0; // foo bar baz
                }
                >
                with
                >
                "lc -A -ansi89 foo.c"
                >
                (minus the quotes), no diagnostic is produced; but isn't this style of
                comment illegal in C89 and thus this piece of code should be invalid?
                >
                How standards conformant is (unnamed compiler)?
                oh no it accepts C++ style comments!!
                really, who cares!!
                >

                Comment

                • santosh

                  #9
                  Re: lcc-win32 conformance question

                  Serve Laurijssen wrote:
                  >
                  "teapot" <tea@pot.invali dschreef in bericht
                  news:1910893.vo mING923G@aioe.o rg...
                  >>
                  >If I compile this program
                  >>
                  >int main(void)
                  >{
                  > return 0; // foo bar baz
                  >}
                  >>
                  >with
                  >>
                  > "lc -A -ansi89 foo.c"
                  >>
                  >(minus the quotes), no diagnostic is produced; but isn't this style
                  >of comment illegal in C89 and thus this piece of code should be
                  >invalid?
                  >>
                  >How standards conformant is (unnamed compiler)?
                  >
                  oh no it accepts C++ style comments!!
                  really, who cares!!
                  Anyone who wants to compile the same code under a strictly C90
                  conforming mode on another compiler which does reject C++ style
                  comments as syntax errors. All is well if that compiler happens to have
                  a switch to make it specifically accept this comment style while
                  retaining strict C90 conformance in all other respects, but most
                  compilers don't have such fine-grained control. You'll probably need to
                  compile the code under either C99 conformance (which in turn may not
                  even be available), or in some other "relaxed" mode which might accept
                  other non-C90 constructs that would otherwise have been diagnosed.

                  Comment

                  • CBFalconer

                    #10
                    Re: lcc-win32 conformance question

                    Serve Laurijssen wrote:
                    "teapot" <tea@pot.invali dschreef in bericht
                    >
                    >If I compile this program
                    >>
                    >int main(void) {
                    > return 0; // foo bar baz
                    >}
                    >>
                    >with "lc -A -ansi89 foo.c"
                    >>
                    >(minus the quotes), no diagnostic is produced; but isn't this
                    >style of comment illegal in C89 and thus this piece of code
                    >should be invalid?
                    >>
                    >How standards conformant is (unnamed compiler)?
                    >
                    oh no it accepts C++ style comments!! really, who cares!!
                    Anyone trying to prepare source suitable for a C90 compiler, or for
                    publication on a Usenet newsgroup.

                    --
                    [mail]: Chuck F (cbfalconer at maineline dot net)
                    [page]: <http://cbfalconer.home .att.net>
                    Try the download section.


                    ** Posted from http://www.teranews.com **

                    Comment

                    • Malcolm McLean

                      #11
                      Re: lcc-win32 conformance question


                      "Serve Laurijssen" <ni@hao.comwrot e in message
                      oh no it accepts C++ style comments!!
                      really, who cares!!
                      >
                      My Message Passing Interface (MPI) compiler won't accept slash slash
                      comments. So any portable functions including them have to be rewritten for
                      it.

                      It surprised me.

                      --
                      Free games and programming goodies.


                      Comment

                      • ymuntyan@gmail.com

                        #12
                        Re: lcc-win32 conformance question

                        On Apr 25, 7:17 pm, Ben Bacarisse <ben.use...@bsb .me.ukwrote:
                        teapot <t...@pot.inval idwrites:
                        If I compile this program
                        >
                        int main(void)
                        {
                        return 0; // foo bar baz
                        }
                        >
                        with
                        >
                        "lc -A -ansi89 foo.c"
                        >
                        (minus the quotes), no diagnostic is produced; but isn't this style of
                        comment illegal in C89 and thus this piece of code should be invalid?
                        >
                        If the compiler claims conformance to the obvious standard when passed
                        that flag then it is in error.
                        Why is it an error? A C90 compiler can reject that program,
                        that's clear; but why does it have to?

                        Yevgen

                        Comment

                        • ymuntyan@gmail.com

                          #13
                          Re: lcc-win32 conformance question

                          On Apr 26, 6:37 am, santosh <santosh....@gm ail.comwrote:
                          jacob navia wrote:
                          Ian Collins wrote:
                          teapot wrote:
                          >If I compile this program
                          >
                          >int main(void)
                          >{
                          > return 0; // foo bar baz
                          >}
                          >
                          >with
                          >
                          > "lc -A -ansi89 foo.c"
                          >
                          >(minus the quotes), no diagnostic is produced; but isn't this style
                          >of comment illegal in C89 and thus this piece of code should be
                          >invalid?
                          >
                          >How standards conformant is (unnamed compiler)?
                          >
                          Why are you asking on a C++ group?
                          >
                          Because pissing lcc-win is his favorite spot, like my cat
                          that pisses everywhere even in my computer!
                          >
                          In any case is what the OP claims true? Are there command-line switches
                          to get a diagnostic for C++ style comments when compiler in strict C90
                          mode?
                          >
                          PS. I think you should cool down a little and not give these anonymous
                          posters much weightage (except if they do uncover a real issue in
                          lcc-win). Even your prose has started suffering.
                          Jacob certainly should not overreact, he harms himself with
                          that. But you should admit that all the posters assumed
                          that the given issue is a non-conformance bug, yet nobody
                          said why it is so. Or at least nobody said that it was *not*
                          a conformance bug, which effectively is the same thing as
                          agreeing that it was (comp.lang.c - best resource for newbies,
                          all mistakes corrected, etc.)

                          Yevgen

                          Comment

                          • Lew Pitcher

                            #14
                            Re: lcc-win32 conformance question

                            In comp.lang.c, teapot wrote:
                            >
                            If I compile this program
                            >
                            int main(void)
                            {
                            return 0; // foo bar baz
                            }
                            >
                            with
                            >
                            "lc -A -ansi89 foo.c"
                            >
                            (minus the quotes), no diagnostic is produced; but isn't this style of
                            comment illegal in C89
                            As I understand it, there is nothing in the C89 standard that explicitly
                            indicates that the C++-style // comment is illegal.

                            However, a compliant compiler is obliged to interpret the given line
                            // foo bar baz
                            as
                            a division token, followed by
                            a division token, followed by
                            an identifier token, followed by
                            an identifier token, followed by
                            an identifier token, followed by
                            a right brace bracket
                            which, of course, cannot be interpreted as a semantically correct C (C89)
                            statement. IIRC, a diagnostic should be emitted.


                            and thus this piece of code should be invalid?
                            >
                            How standards conformant is (unnamed compiler)?
                            --
                            Lew Pitcher

                            Master Codewright & JOAT-in-training | Registered Linux User #112576
                            http://pitcher.digitalfreehold.ca/ | GPG public key available by request
                            ---------- Slackware - Because I know what I'm doing. ------


                            Comment

                            • Ben Bacarisse

                              #15
                              Re: lcc-win32 conformance question

                              ymuntyan@gmail. com writes:
                              On Apr 25, 7:17 pm, Ben Bacarisse <ben.use...@bsb .me.ukwrote:
                              >teapot <t...@pot.inval idwrites:
                              If I compile this program
                              >>
                              int main(void)
                              {
                              return 0; // foo bar baz
                              }
                              >>
                              with
                              >>
                              "lc -A -ansi89 foo.c"
                              >>
                              (minus the quotes), no diagnostic is produced; but isn't this style of
                              comment illegal in C89 and thus this piece of code should be invalid?
                              >>
                              >If the compiler claims conformance to the obvious standard when passed
                              >that flag then it is in error.
                              >
                              Why is it an error? A C90 compiler can reject that program,
                              that's clear; but why does it have to?
                              Because it contains a syntax error. It need not reject it, but a
                              diagnostic is required. The "error" is that the compiler is silent.

                              As I said (in snipped text) I have no idea if the -ansi89 flag does
                              what one might guess it does. As far as I can see lcc-win32 accepts
                              all kinds of stuff that require a diagnostic when seen by a C90
                              compiler. Unless someone says what the -ansi89 flag *should* do we
                              must be silent.

                              --
                              Ben.

                              Comment

                              Working...