Header include order

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

    #46
    Re: Header include order

    E. Robert Tisdale wrote:
    [color=blue]
    > The standard does *not* specify
    > whether size_t is defined in stdlib.h itself
    > or in another header file included by stdlib.h
    > so the standard is *irrelevant* to the question.[/color]

    On the contrary - since the standard doesn't specify it, we should not write
    code that relies on it.
    [color=blue]
    > The only thing that may be relevant
    > is whether or not *any* implementation of the standard
    > actually defines size_t in stdlib.h itself.[/color]

    No, /that/ is entirely irrelevant.

    --
    Richard Heathfield : binary@eton.pow ernet.co.uk
    "Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
    C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
    K&R answers, C books, etc: http://users.powernet.co.uk/eton

    Comment

    • Alex

      #47
      Re: Header include order

      E. Robert Tisdale <E.Robert.Tisda le@jpl.nasa.gov > wrote:[color=blue]
      > Alex wrote:
      >[color=green]
      >> $ cat test.c
      >> #define _SIZE_T
      >> #include <stdlib.h>
      >>
      >> size_t size = 32;
      >>
      >> $ gcc -W -Wall -ansi -pedantic test.c[/color][/color]
      [color=blue]
      > Evidently, this is *not* the Sun C compiler for Solaris 2.6
      > but some version of the GNU C compiler.[/color]

      No, but the headers being used, to the best of my knowledge,
      *are* from the Sun C compiler:

      /*
      * Copyright (c) 1996, by Sun Microsystems, Inc.
      * All Rights reserved.
      */

      I would use the Sun C compiler for this example if it weren't
      for:

      $ cc
      /usr/ucb/cc: language optional software package not installed
      [color=blue]
      > Could you type[/color]
      [color=blue]
      > gcc --version[/color]

      $ gcc --version
      egcs-2.91.60


      <snip>
      [color=blue]
      > The stdlib.h distributed with gcc version 3.2
      > includes stddef.h to define size_t. I get[/color]

      That's nice. It doesn't have to.
      [color=blue][color=green]
      > > gcc -Wall -std=c99 -pedantic -c test.c[/color]
      > In file included from test.c:2:
      > /usr/include/stdlib.h:137: parse error before "__ctype_get_mb _cur_max"
      > /usr/include/stdlib.h:137: ISO C forbids data definition with no type or
      > storage class
      > /usr/include/stdlib.h:554: parse error before "__size"
      > /usr/include/stdlib.h:556: parse error before "__nmemb"
      > /usr/include/stdlib.h:565: parse error before "size_t"
      > /usr/include/stdlib.h:731: parse error before "size_t"
      > /usr/include/stdlib.h:735: parse error before "size_t"
      > /usr/include/stdlib.h:822: parse error before "size_t"
      > /usr/include/stdlib.h:826: parse error before "size_t"
      > /usr/include/stdlib.h:833: parse error before "mbstowcs"
      > /usr/include/stdlib.h:834: parse error before "size_t"
      > /usr/include/stdlib.h:834: ISO C forbids data definition with no type or
      > storage class
      > /usr/include/stdlib.h:836: parse error before "wcstombs"
      > /usr/include/stdlib.h:837: parse error before "size_t"
      > /usr/include/stdlib.h:838: ISO C forbids data definition with no type or
      > storage class
      > test.c:4: parse error before "size"
      > test.c:4: warning: type defaults to `int' in declaration of `size'
      > test.c:4: ISO C forbids data definition with no type or storage class[/color]
      [color=blue]
      > so my experiment doesn't prove that
      > *your* implementation defines size_t in stdlib.h itself either.[/color]

      That doesn't surprise me. As I've pointed out before, your
      reasoning is inane. What is to prevent the implementation
      from defining size_t within stddef.h with a similar preprocessor
      conditional block to what I have in my stdlib.h?

      For a change of pace. Please prove that all past, present,
      and future implementations have/do/will always include another
      header within stdlib.h in order to define size_t. Until such time,
      if you are interested in specific implementations , please refer
      to the appropriate newsgroups. As far as this newsgroup is
      concerned, your assertion is baseless.

      Alex

      Comment

      • Dan Pop

        #48
        Re: Header include order

        In <3FBE5AD7.40602 07@jpl.nasa.gov > "E. Robert Tisdale" <E.Robert.Tisda le@jpl.nasa.gov > writes:
        [color=blue]
        >Alex wrote:
        >[color=green]
        >> E. Robert Tisdale wrote:
        >>[color=darkred]
        >>>All you need to do to prove my assertion false
        >>>is to present *one* example of an implementation
        >>>where size_t is defined in stdlib.h and *not*
        >>>in some included header file.[/color]
        >>
        >>
        >> If you insist. Solaris 2.6:[/color]
        >
        >I suppose you mean the Sun C compiler
        >that you got bundled with Solaris 2.6?
        >[color=green]
        >>
        >> /usr/include/stdlib.h:
        >>
        >> <...>
        >>
        >> #ifndef _SIZE_T
        >> #define _SIZE_T
        >> typedef unsigned int size_t;
        >> #endif
        >>
        >> <...>[/color]
        >
        >I don't mean to quibble but
        >you haven't actually shown that size_t gets defined in stdlib.h
        >Try to compile
        >
        > #define _SIZE_T
        > #include <stdlib.h>
        >
        > size_t size = 32;
        >
        >with your Sun C compiler and show us the diagnostic message
        >that it issues. ^^^^^^^[/color]

        Why did you use the singular?

        znsun1:~/tmp 9> uname -a
        SunOS znsun1 5.6 Generic_105181-23 sun4u sparc
        znsun1:~/tmp 10> which cc
        /opt/SUNWspro/bin/cc
        znsun1:~/tmp 11> cat test.c
        #define _SIZE_T
        #include <stdlib.h>

        size_t size = 32;
        znsun1:~/tmp 12> cc test.c
        "/usr/include/stdlib.h", line 106: parameter redeclared: size_t
        "/usr/include/stdlib.h", line 106: warning: function prototype parameters must have types
        "/usr/include/stdlib.h", line 108: warning: function prototype parameters must have types
        "/usr/include/stdlib.h", line 109: syntax error before or at: size_t
        "/usr/include/stdlib.h", line 109: warning: undefined or missing type for: size_t
        "/usr/include/stdlib.h", line 118: syntax error before or at: size_t
        "/usr/include/stdlib.h", line 118: warning: undefined or missing type for: size_t
        "/usr/include/stdlib.h", line 119: syntax error before or at: int
        "/usr/include/stdlib.h", line 119: warning: undefined or missing type for: int
        "/usr/include/stdlib.h", line 119: function cannot return function or array
        "/usr/include/stdlib.h", line 119: syntax error before or at: )
        "/usr/include/stdlib.h", line 119: warning: syntax error: empty declaration
        "/usr/include/stdlib.h", line 120: syntax error before or at: size_t
        "/usr/include/stdlib.h", line 120: warning: undefined or missing type for: size_t
        "/usr/include/stdlib.h", line 121: syntax error before or at: int
        "/usr/include/stdlib.h", line 121: warning: undefined or missing type for: int
        "/usr/include/stdlib.h", line 121: function cannot return function or array
        "/usr/include/stdlib.h", line 121: syntax error before or at: )
        "/usr/include/stdlib.h", line 121: warning: syntax error: empty declaration
        "/usr/include/stdlib.h", line 128: syntax error before or at: size_t
        "/usr/include/stdlib.h", line 128: warning: undefined or missing type for: size_t
        "/usr/include/stdlib.h", line 129: syntax error before or at: size_t
        "/usr/include/stdlib.h", line 129: warning: undefined or missing type for: size_t
        "/usr/include/stdlib.h", line 132: syntax error before or at: mbstowcs
        "/usr/include/stdlib.h", line 132: syntax error before or at: size_t
        "/usr/include/stdlib.h", line 132: warning: undefined or missing type for: size_t
        "/usr/include/stdlib.h", line 132: warning: old-style declaration or incorrect type for: mbstowcs
        "/usr/include/stdlib.h", line 133: syntax error before or at: wcstombs
        "/usr/include/stdlib.h", line 133: syntax error before or at: size_t
        "/usr/include/stdlib.h", line 133: warning: undefined or missing type for: size_t
        "/usr/include/stdlib.h", line 133: warning: old-style declaration or incorrect type for: wcstombs
        "/usr/include/stdlib.h", line 175: syntax error before or at: size_t
        "/usr/include/stdlib.h", line 175: warning: undefined or missing type for: size_t
        "/usr/include/stdlib.h", line 185: warning: function prototype parameters must have types
        "/usr/include/stdlib.h", line 194: syntax error before or at: size_t
        "/usr/include/stdlib.h", line 194: warning: undefined or missing type for: size_t
        "/usr/include/stdlib.h", line 204: parameter redeclared: size_t
        "/usr/include/stdlib.h", line 204: warning: function prototype parameters must have types
        "test.c", line 4: warning: old-style declaration or incorrect type for: size_t
        "test.c", line 4: syntax error before or at: size
        "test.c", line 4: warning: old-style declaration or incorrect type for: size
        cc: acomp failed for test.c

        Which was to be expected: you told <stdlib.h> (and any headers it might
        include) that size_t is *already* defined, which was a lie. You know what
        it happens when you lie to your implementation, right?

        Dan
        --
        Dan Pop
        DESY Zeuthen, RZ group
        Email: Dan.Pop@ifh.de

        Comment

        • E. Robert Tisdale

          #49
          Re: Header include order

          Alex wrote:
          [color=blue]
          > E. Robert Tisdale wrote:
          >[color=green]
          >>Alex wrote:
          >>[color=darkred]
          >>>$ cat test.c
          >>>#define _SIZE_T
          >>>#include <stdlib.h>
          >>>
          >>>size_t size = 32;
          >>>
          >>>$ gcc -W -Wall -ansi -pedantic test.c[/color][/color]
          >[color=green]
          >>Evidently, this is *not* the Sun C compiler for Solaris 2.6
          >>but some version of the GNU C compiler.[/color]
          >
          > No, but the headers being used, to the best of my knowledge,
          > *are* from the Sun C compiler:
          >
          > /*
          > * Copyright (c) 1996, by Sun Microsystems, Inc.
          > * All Rights reserved.
          > */[/color]

          Perhaps, but not likely. Type

          gcc -v -W -Wall -ansi -pedantic test.c

          at your Solaris prompt and gcc should show you
          the paths that it searched for system header files.
          [color=blue]
          >
          > I would use the Sun C compiler for this example if it weren't for:
          >
          > $ cc
          > /usr/ucb/cc: language optional software package not installed
          >[color=green]
          >>Could you type[/color]
          >[color=green]
          >> gcc --version[/color]
          >
          > $ gcc --version
          > egcs-2.91.60
          >
          > <snip>
          >[color=green]
          >>The stdlib.h distributed with gcc version 3.2
          >>includes stddef.h to define size_t. I get[/color]
          >
          > That's nice. It doesn't have to.[/color]

          Did I say differently?
          [color=blue][color=green][color=darkred]
          >> > gcc -Wall -std=c99 -pedantic -c test.c[/color]
          >>In file included from test.c:2:
          >>/usr/include/stdlib.h:137: parse error before "__ctype_get_mb _cur_max"
          >>/usr/include/stdlib.h:137: ISO C forbids data definition with no type or
          >>storage class
          >>/usr/include/stdlib.h:554: parse error before "__size"
          >>/usr/include/stdlib.h:556: parse error before "__nmemb"
          >>/usr/include/stdlib.h:565: parse error before "size_t"
          >>/usr/include/stdlib.h:731: parse error before "size_t"
          >>/usr/include/stdlib.h:735: parse error before "size_t"
          >>/usr/include/stdlib.h:822: parse error before "size_t"
          >>/usr/include/stdlib.h:826: parse error before "size_t"
          >>/usr/include/stdlib.h:833: parse error before "mbstowcs"
          >>/usr/include/stdlib.h:834: parse error before "size_t"
          >>/usr/include/stdlib.h:834: ISO C forbids data definition with no type or
          >>storage class
          >>/usr/include/stdlib.h:836: parse error before "wcstombs"
          >>/usr/include/stdlib.h:837: parse error before "size_t"
          >>/usr/include/stdlib.h:838: ISO C forbids data definition with no type or
          >>storage class
          >>test.c:4: parse error before "size"
          >>test.c:4: warning: type defaults to `int' in declaration of `size'
          >>test.c:4: ISO C forbids data definition with no type or storage class[/color]
          >[color=green]
          >>so my experiment doesn't prove that
          >>*your* implementation defines size_t in stdlib.h itself either.[/color]
          >
          > That doesn't surprise me. As I've pointed out before, your
          > reasoning is inane. What is to prevent the implementation
          > from defining size_t within stddef.h with a similar preprocessor
          > conditional block to what I have in my stdlib.h?
          >
          > For a change of pace. Please prove that all past, present,
          > and future implementations have/do/will always include another
          > header within stdlib.h in order to define size_t.[/color]

          This is a "straw man" argument.



          I *never* claimed that all past or future implementations
          must include another header file in stdlib.h to define size_t.
          All I asked you to do is show us *one* implementation that does not.
          [color=blue]
          > Until such time, if you are interested in specific implementations ,
          > please refer to the appropriate newsgroups.
          > As far as this newsgroup is concerned, your assertion is baseless.[/color]

          You're the one who claims that your implementation defines size_t
          in stdlib.h itself. All I'm saying is that you haven't shown that yet.
          I've been trying my best to help you but your evidence, so far,
          is unconvincing.


          The point is that the ANSI/ISO C standards are very carefully written
          to avoid specifying any unnecessary details about the implementation.
          You need to be very careful when making statements about implementations
          based upon your interpretation of the standards.

          Comment

          • E. Robert Tisdale

            #50
            Re: Header include order

            CBFalconer wrote:
            [color=blue]
            > _______________ ______
            > /| /| | |
            > ||__|| | Please do not |
            > / O O\__ | feed the |
            > / \ | Trolls |
            > / \ \|_____________ ________|
            > / _ \ \ ||
            > / |\____\ \ ||
            > / | | | |\____/ ||
            > / \|_|_|/ | _||
            > / / \ |____| ||
            > / | | | --|
            > | | | |____ --|
            > * _ | |_|_|_| | \-/
            > *-- _--\ _ \ | ||
            > / _ \\ | / `
            > * / \_ /- | | |
            > * ___ c_c_c_C/ \C_c_c_c_______ _____
            >
            > +-------------------+ .:\:\:/:/:.
            > | PLEASE DO NOT | :.:\:\:/:/:.:
            > | FEED THE TROLLS | :=.' - - '.=:
            > | | '=(\ 9 9 /)='
            > | Thank you, | ( (_) )
            > | Management | /`-vvv-'\
            > +-------------------+ / \
            > | | @@@ / /|,,,,,|\ \
            > | | @@@ /_// /^\ \\_\
            > @x@@x@ | | |/ WW( ( ) )WW
            > \||||/ | | \| __\,,\ /,,/__
            > \||/ | | | jgs (______Y______)
            > /\/\/\/\/\/\/\/\//\/\\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
            > =============== =============== =============== =============== ==[/color]

            Evidently, your definition of a troll is anyone who disagrees with you.
            For you, it's just another epithet that you hurl at an opponent.
            You resort to ad hominem attacks



            when you have lost an argument
            and have no valid argument to contribute to the discussion.
            The use of such an obviously fallacious argument shows contempt
            for subscribers if you really expect to sway them with it.
            Or do you honestly believe that you are making a valid argument?

            Comment

            • Alex

              #51
              Re: Header include order

              E. Robert Tisdale <E.Robert.Tisda le@jpl.nasa.gov > wrote:[color=blue]
              > Alex wrote:[/color]
              [color=blue][color=green]
              >> E. Robert Tisdale wrote:
              >>[color=darkred]
              >>>Alex wrote:
              >>>
              >>>>$ cat test.c
              >>>>#define _SIZE_T
              >>>>#include <stdlib.h>
              >>>>
              >>>>size_t size = 32;
              >>>>
              >>>>$ gcc -W -Wall -ansi -pedantic test.c[/color]
              >>[color=darkred]
              >>>Evidently, this is *not* the Sun C compiler for Solaris 2.6
              >>>but some version of the GNU C compiler.[/color]
              >>
              >> No, but the headers being used, to the best of my knowledge,
              >> *are* from the Sun C compiler:
              >>
              >> /*
              >> * Copyright (c) 1996, by Sun Microsystems, Inc.
              >> * All Rights reserved.
              >> */[/color][/color]
              [color=blue]
              > Perhaps, but not likely. Type[/color]
              [color=blue]
              > gcc -v -W -Wall -ansi -pedantic test.c[/color]

              I don't need to. From the output I posted earlier

              /usr/include/stdlib.h:106: warning: parameter names <...>

              ....you can clearly see the path. This is indeed the file
              with the Sun copyright you see above.
              [color=blue]
              >[color=green][color=darkred]
              >>>The stdlib.h distributed with gcc version 3.2
              >>>includes stddef.h to define size_t. I get[/color]
              >>
              >> That's nice. It doesn't have to.[/color][/color]
              [color=blue]
              > Did I say differently?[/color]

              Yes. I said:
              [color=blue][color=green][color=darkred]
              >>>>Where is the definition for size_t?[/color][/color][/color]

              You said:
              [color=blue][color=green][color=darkred]
              >>>In a header file included by stdlib.h[/color][/color][/color]

              It doesn't have to be. It *could* be defined in stdlib.h.
              Which, I thought, was pretty obvious. However, you went
              out on a tangent, trying to make me prove that there is
              indeed an implementation where size_t is defined in
              stdlib.h. Such proof is inherently irrelevant!
              [color=blue]
              >[color=green]
              >> For a change of pace. Please prove that all past, present,
              >> and future implementations have/do/will always include another
              >> header within stdlib.h in order to define size_t.[/color][/color]
              [color=blue]
              > I *never* claimed that all past or future implementations
              > must include another header file in stdlib.h to define size_t.
              > All I asked you to do is show us *one* implementation that does not.[/color]

              If you are aware of the fact that there *can* be an
              implementation where size_t is defined in stdlib.h, why
              are you arguing? Are you going to write code to depend
              on that fact (I wonder how...) until I find you an
              implementation where it would fail? Which I did.

              [color=blue][color=green]
              >> Until such time, if you are interested in specific implementations ,
              >> please refer to the appropriate newsgroups.
              >> As far as this newsgroup is concerned, your assertion is baseless.[/color][/color]
              [color=blue]
              > You're the one who claims that your implementation defines size_t
              > in stdlib.h itself.[/color]

              You claimed that stdlib.h includes another header to
              define size_t. I pointed out that it was speculation
              on your part, since the standard does not define it.
              [color=blue]
              > The point is that the ANSI/ISO C standards are very carefully written
              > to avoid specifying any unnecessary details about the implementation.
              > You need to be very careful when making statements about implementations
              > based upon your interpretation of the standards.[/color]

              That is *my* point. Again, you said that stdlib.h
              includes a header to define size_t. I pointed out
              that it doesn't have to, according to the standard.

              Can it be any simpler than that? Are you trolling?

              Alex

              Comment

              • E. Robert Tisdale

                #52
                Re: Header include order

                Alex wrote:
                [color=blue]
                > E. Robert Tisdale wrote:
                >[color=green]
                >>Alex wrote:[/color]
                >[color=green][color=darkred]
                >>>E. Robert Tisdale wrote:
                >>>
                >>>>Alex wrote:
                >>>>
                >>>>>$ cat test.c
                >>>>>#define _SIZE_T
                >>>>>#include <stdlib.h>
                >>>>>
                >>>>>size_t size = 32;
                >>>>>
                >>>>>$ gcc -W -Wall -ansi -pedantic test.c
                >>>>
                >>>>Evidently , this is *not* the Sun C compiler for Solaris 2.6
                >>>>but some version of the GNU C compiler.
                >>>
                >>>No, but the headers being used, to the best of my knowledge,
                >>>*are* from the Sun C compiler:
                >>>
                >>> /*
                >>> * Copyright (c) 1996, by Sun Microsystems, Inc.
                >>> * All Rights reserved.
                >>> */[/color][/color]
                >[color=green]
                >>Perhaps, but not likely. Type[/color]
                >[color=green]
                >> gcc -v -W -Wall -ansi -pedantic test.c[/color]
                >
                > I don't need to. From the output I posted earlier
                >
                > /usr/include/stdlib.h:106: warning: parameter names <...>
                >
                > ...you can clearly see the path.
                > This is indeed the file with the Sun copyright you see above.[/color]

                I found this same copyright notice in 88 header files
                in the implementation distributed with version 3.2 of gcc.
                Regardless of origin, your stdlib.h header file
                is almost certainly part of the GNU C implementation
                distributed with gcc.
                [color=blue]
                >
                >[color=green][color=darkred]
                >>>>The stdlib.h distributed with gcc version 3.2
                >>>>includes stddef.h to define size_t. I get
                >>>
                >>>That's nice. It doesn't have to.[/color][/color]
                >[color=green]
                >>Did I say differently?[/color]
                >
                > Yes. I said:
                >[color=green][color=darkred]
                >>>>>Where is the definition for size_t?[/color][/color]
                >
                > You said:
                >[color=green][color=darkred]
                >>>>In a header file included by stdlib.h[/color][/color]
                >
                > It doesn't have to be. It *could* be defined in stdlib.h.[/color]

                I never said differently.
                But the fact that size_t *could* be defined in stdlib.h itself
                does *not* mean that size_t *is* defined in stdlib.h itself.
                [color=blue]
                > Which, I thought, was pretty obvious. However,
                > you went out on a tangent, trying to make me prove that
                > there is indeed an implementation
                > where size_t is defined in stdlib.h.
                > Such proof is inherently irrelevant![/color]

                It is *not* irrelevant to your claim
                that you have found an implementation
                where size_t is actually defined in stdlib.h itself.
                Are you prepared to concede that you were wrong?
                [color=blue][color=green][color=darkred]
                >>>For a change of pace. Please prove that all past, present,
                >>>and future implementations have/do/will always include another
                >>>header within stdlib.h in order to define size_t.[/color][/color]
                >[color=green]
                >>I *never* claimed that all past or future implementations
                >>must include another header file in stdlib.h to define size_t.
                >>All I asked you to do is show us *one* implementation that does not.[/color]
                >
                > If you are aware of the fact that there *can* be an implementation
                > where size_t is defined in stdlib.h, why are you arguing?[/color]

                I assume that you agree that since the ANSI/ISO C standards
                do not specify that size_t is defined in stdlib.h itself
                and not in any included header file, all implementations
                *could* define size_t in a header file included by stdlib.h.
                My assertion is simply that, in fact, all implementations
                *do* define size_t in a header file included by stdlib.h.
                All you need to do to disprove my assertion is to provide
                one example of an implementation that actually defines size_t
                in stdlib.h itself.
                [color=blue]
                > Are you going to write code to depend on that fact (I wonder how...)
                > until I find you an implementation where it would fail? Which I did.[/color]

                No. You haven't demonstrated that
                size_t is actually defined in stdlib.h itself.
                [color=blue][color=green][color=darkred]
                >>>Until such time, if you are interested in specific implementations ,
                >>>please refer to the appropriate newsgroups.
                >>>As far as this newsgroup is concerned, your assertion is baseless.[/color][/color]
                >[color=green]
                >>You're the one who claims that your implementation defines size_t
                >>in stdlib.h itself.[/color]
                >
                > You claimed that stdlib.h includes another header to define size_t.
                > I pointed out that it was speculation on your part
                > since the standard does not define it.[/color]

                And I have pointed out that the ANSI/ISO C standards are irrelevant
                to the question of whether or not size_t is defined in a header file
                included by stdlib.h.
                You are just ignorant of all the other considerations,
                besides the standard, that go into an implementation.
                For example, size_t is useful at a much lower level than stdlib.h
                in most implementations so it is *always* defined
                in a lower level header file included in stdlib.h.
                [color=blue][color=green]
                >>The point is that the ANSI/ISO C standards are very carefully written
                >>to avoid specifying any unnecessary details about the implementation.
                >>You need to be very careful when making statements about implementations
                >>based upon your interpretation of the standards.[/color]
                >
                > That is *my* point. Again, you said that stdlib.h
                > includes a header to define size_t. I pointed out
                > that it doesn't have to, according to the standard.[/color]

                And I never argued this point. I only asserted that
                size_t was actually defined in a header file included by stdlib.h.
                The absence of even one contradictory example supports my assertion.

                Comment

                • Alex

                  #53
                  Re: Header include order

                  E. Robert Tisdale <E.Robert.Tisda le@jpl.nasa.gov > wrote:[color=blue]
                  > Alex wrote:[color=green]
                  >> E. Robert Tisdale wrote:[/color][/color]
                  [color=blue][color=green][color=darkred]
                  >>>The point is that the ANSI/ISO C standards are very carefully written
                  >>>to avoid specifying any unnecessary details about the implementation.
                  >>>You need to be very careful when making statements about implementations
                  >>>based upon your interpretation of the standards.[/color]
                  >>
                  >> That is *my* point. Again, you said that stdlib.h
                  >> includes a header to define size_t. I pointed out
                  >> that it doesn't have to, according to the standard.[/color][/color]
                  [color=blue]
                  > And I never argued this point. I only asserted that
                  > size_t was actually defined in a header file included by stdlib.h.
                  > The absence of even one contradictory example supports my assertion.[/color]

                  You are obviously trolling. I resign from this discussion.

                  Alex

                  Comment

                  • E. Robert Tisdale

                    #54
                    Re: Header include order

                    Alex wrote:
                    [color=blue]
                    > I have lost this argument so you're a troll.[/color]

                    Comment

                    • Mark Gordon

                      #55
                      Re: Header include order

                      On Mon, 24 Nov 2003 14:13:56 -0800
                      "E. Robert Tisdale" <E.Robert.Tisda le@jpl.nasa.gov > wrote:
                      [color=blue]
                      > Alex wrote:
                      >[color=green]
                      > > E. Robert Tisdale wrote:
                      > >[color=darkred]
                      > >>Alex wrote:[/color]
                      > >[color=darkred]
                      > >>>E. Robert Tisdale wrote:
                      > >>>
                      > >>>>Alex wrote:
                      > >>>>
                      > >>>>>$ cat test.c
                      > >>>>>#define _SIZE_T
                      > >>>>>#include <stdlib.h>
                      > >>>>>
                      > >>>>>size_t size = 32;
                      > >>>>>
                      > >>>>>$ gcc -W -Wall -ansi -pedantic test.c
                      > >>>>
                      > >>>>Evidently , this is *not* the Sun C compiler for Solaris 2.6
                      > >>>>but some version of the GNU C compiler.
                      > >>>
                      > >>>No, but the headers being used, to the best of my knowledge,
                      > >>>*are* from the Sun C compiler:
                      > >>>
                      > >>> /*
                      > >>> * Copyright (c) 1996, by Sun Microsystems, Inc.
                      > >>> * All Rights reserved.
                      > >>> */[/color]
                      > >[color=darkred]
                      > >>Perhaps, but not likely. Type[/color]
                      > >[color=darkred]
                      > >> gcc -v -W -Wall -ansi -pedantic test.c[/color]
                      > >
                      > > I don't need to. From the output I posted earlier
                      > >
                      > > /usr/include/stdlib.h:106: warning: parameter names <...>
                      > >
                      > > ...you can clearly see the path.
                      > > This is indeed the file with the Sun copyright you see above.[/color]
                      >
                      > I found this same copyright notice in 88 header files
                      > in the implementation distributed with version 3.2 of gcc.
                      > Regardless of origin, your stdlib.h header file
                      > is almost certainly part of the GNU C implementation
                      > distributed with gcc.[/color]

                      Since according to you the GCC headers are copyright Sun, perhaps you
                      will accept a header copyright IBM that was distributed with either AIC
                      or the AIX compiler?

                      /* IBM_PROLOG_BEGI N_TAG */
                      /* This is an automatically generated prolog. */
                      /* */
                      /* bos43V src/bos/usr/include/stdlib.h 1.31.6.2 */
                      /* */
                      /* Licensed Materials - Property of IBM */
                      /* */
                      /* (C) COPYRIGHT International Business Machines Corp. 1985,1995 */

                      ....


                      #ifndef _H_STANDARDS
                      #include <standards.h>
                      #endif

                      The above is the only file included by this header, and is does not
                      define SIZE_T not does it include anything else

                      #ifndef _SIZE_T
                      #define _SIZE_T
                      typedef unsigned long size_t;
                      #endif

                      So with the version of CC and headers that IBM provide size_t IS defined
                      in stdlib.h and NOT in a file included by it.

                      Obviously I can't post the include files in there entirety since they
                      are copyright, so you can either believe me, buy a copy of AIX and it's
                      development system, or call me a lier.
                      [color=blue][color=green][color=darkred]
                      > >>>>The stdlib.h distributed with gcc version 3.2
                      > >>>>includes stddef.h to define size_t. I get
                      > >>>
                      > >>>That's nice. It doesn't have to.[/color]
                      > >[color=darkred]
                      > >>Did I say differently?[/color]
                      > >
                      > > Yes. I said:
                      > >[color=darkred]
                      > >>>>>Where is the definition for size_t?[/color]
                      > >
                      > > You said:
                      > >[color=darkred]
                      > >>>>In a header file included by stdlib.h[/color]
                      > >
                      > > It doesn't have to be. It *could* be defined in stdlib.h.[/color]
                      >
                      > I never said differently.
                      > But the fact that size_t *could* be defined in stdlib.h itself
                      > does *not* mean that size_t *is* defined in stdlib.h itself.[/color]

                      You said "In a header included by stdlib.h" not "Possibly in a header
                      included by stdlib.h" so you have definitely been proved wrong. since on
                      AIX 4.3 it IS defined in stdlib.h and NOT in any headers included by
                      stdlib.h.
                      [color=blue][color=green]
                      > > Which, I thought, was pretty obvious. However,
                      > > you went out on a tangent, trying to make me prove that
                      > > there is indeed an implementation
                      > > where size_t is defined in stdlib.h.
                      > > Such proof is inherently irrelevant![/color]
                      >
                      > It is *not* irrelevant to your claim
                      > that you have found an implementation
                      > where size_t is actually defined in stdlib.h itself.
                      > Are you prepared to concede that you were wrong?[/color]

                      Why should he when he is correct?
                      [color=blue][color=green][color=darkred]
                      > >>>For a change of pace. Please prove that all past, present,
                      > >>>and future implementations have/do/will always include another
                      > >>>header within stdlib.h in order to define size_t.[/color]
                      > >[color=darkred]
                      > >>I *never* claimed that all past or future implementations
                      > >>must include another header file in stdlib.h to define size_t.
                      > >>All I asked you to do is show us *one* implementation that does not.[/color]
                      > >
                      > > If you are aware of the fact that there *can* be an implementation
                      > > where size_t is defined in stdlib.h, why are you arguing?[/color]
                      >
                      > I assume that you agree that since the ANSI/ISO C standards
                      > do not specify that size_t is defined in stdlib.h itself
                      > and not in any included header file, all implementations
                      > *could* define size_t in a header file included by stdlib.h.
                      > My assertion is simply that, in fact, all implementations
                      > *do* define size_t in a header file included by stdlib.h.[/color]

                      You are wrong, see above.
                      [color=blue]
                      > All you need to do to disprove my assertion is to provide
                      > one example of an implementation that actually defines size_t
                      > in stdlib.h itself.[/color]

                      Done. Although it looks to me like you already had an example.
                      [color=blue][color=green]
                      > > Are you going to write code to depend on that fact (I wonder how...)
                      > > until I find you an implementation where it would fail? Which I
                      > > did.[/color]
                      >
                      > No. You haven't demonstrated that
                      > size_t is actually defined in stdlib.h itself.[/color]

                      It looked like it was defined there to me, it just had protection
                      against duplicate definitions so you could include all the headers that
                      define it which the standard allows you to do.
                      [color=blue][color=green][color=darkred]
                      > >>>Until such time, if you are interested in specific implementations ,
                      > >>>please refer to the appropriate newsgroups.
                      > >>>As far as this newsgroup is concerned, your assertion is baseless.[/color]
                      > >[color=darkred]
                      > >>You're the one who claims that your implementation defines size_t
                      > >>in stdlib.h itself.[/color]
                      > >
                      > > You claimed that stdlib.h includes another header to define size_t.
                      > > I pointed out that it was speculation on your part
                      > > since the standard does not define it.[/color]
                      >
                      > And I have pointed out that the ANSI/ISO C standards are irrelevant
                      > to the question of whether or not size_t is defined in a header file
                      > included by stdlib.h.
                      > You are just ignorant of all the other considerations,
                      > besides the standard, that go into an implementation.
                      > For example, size_t is useful at a much lower level than stdlib.h
                      > in most implementations so it is *always* defined
                      > in a lower level header file included in stdlib.h.[/color]

                      WRONG
                      [color=blue][color=green][color=darkred]
                      > >>The point is that the ANSI/ISO C standards are very carefully
                      > >>written to avoid specifying any unnecessary details about the
                      > >>implementatio n. You need to be very careful when making statements
                      > >>about implementations based upon your interpretation of the
                      > >>standards.[/color]
                      > >
                      > > That is *my* point. Again, you said that stdlib.h
                      > > includes a header to define size_t. I pointed out
                      > > that it doesn't have to, according to the standard.[/color]
                      >
                      > And I never argued this point. I only asserted that
                      > size_t was actually defined in a header file included by stdlib.h.[/color]

                      You actually stated that it IS defined in a header included by stdlib.h
                      and you have done so even more clearly and explicitly in the post.
                      [color=blue]
                      > The absence of even one contradictory example supports my assertion.[/color]

                      Absence of proof is not proof of absence. Anyway, your original
                      assertion and fallacious statement of fact are disproved by the IBM
                      implementation.
                      --
                      Mark Gordon
                      Paid to be a Geek & a Senior Software Developer
                      Although my email address says spamtrap, it is real and I read it.

                      Comment

                      • E. Robert Tisdale

                        #56
                        Re: Header include order

                        Mark Gordon wrote:[color=blue]
                        > On Mon, 24 Nov 2003 14:13:56 -0800
                        > "E. Robert Tisdale" <E.Robert.Tisda le@jpl.nasa.gov > wrote:
                        >
                        >[color=green]
                        >>Alex wrote:
                        >>
                        >>[color=darkred]
                        >>>E. Robert Tisdale wrote:
                        >>>
                        >>>
                        >>>>Alex wrote:
                        >>>
                        >>>>>E. Robert Tisdale wrote:
                        >>>>>
                        >>>>>
                        >>>>>>Alex wrote:
                        >>>>>>
                        >>>>>>
                        >>>>>>>$ cat test.c
                        >>>>>>>#defin e _SIZE_T
                        >>>>>>>#inclu de <stdlib.h>
                        >>>>>>>
                        >>>>>>>size_t size = 32;
                        >>>>>>>
                        >>>>>>>$ gcc -W -Wall -ansi -pedantic test.c
                        >>>>>>
                        >>>>>>Evidently , this is *not* the Sun C compiler for Solaris 2.6
                        >>>>>>but some version of the GNU C compiler.
                        >>>>>
                        >>>>>No, but the headers being used, to the best of my knowledge,
                        >>>>>*are* from the Sun C compiler:
                        >>>>>
                        >>>>> /*
                        >>>>> * Copyright (c) 1996, by Sun Microsystems, Inc.
                        >>>>> * All Rights reserved.
                        >>>>> */
                        >>>>
                        >>>>Perhaps, but not likely. Type
                        >>>
                        >>>> gcc -v -W -Wall -ansi -pedantic test.c
                        >>>
                        >>>I don't need to. From the output I posted earlier
                        >>>
                        >>>/usr/include/stdlib.h:106: warning: parameter names <...>
                        >>>
                        >>>...you can clearly see the path.
                        >>>This is indeed the file with the Sun copyright you see above.[/color]
                        >>
                        >>I found this same copyright notice in 88 header files
                        >>in the implementation distributed with version 3.2 of gcc.
                        >>Regardless of origin, your stdlib.h header file
                        >>is almost certainly part of the GNU C implementation
                        >>distributed with gcc.[/color]
                        >
                        >
                        > Since according to you the GCC headers are copyright Sun, perhaps you
                        > will accept a header copyright IBM that was distributed with either AIC
                        > or the AIX compiler?
                        >
                        > /* IBM_PROLOG_BEGI N_TAG */
                        > /* This is an automatically generated prolog. */
                        > /* */
                        > /* bos43V src/bos/usr/include/stdlib.h 1.31.6.2 */
                        > /* */
                        > /* Licensed Materials - Property of IBM */
                        > /* */
                        > /* (C) COPYRIGHT International Business Machines Corp. 1985,1995 */
                        >
                        > ...
                        >
                        >
                        > #ifndef _H_STANDARDS
                        > #include <standards.h>
                        > #endif
                        >
                        > The above is the only file included by this header, and is does not
                        > define SIZE_T not does it include anything else
                        >
                        > #ifndef _SIZE_T
                        > #define _SIZE_T
                        > typedef unsigned long size_t;
                        > #endif
                        >
                        > So with the version of CC and headers that IBM provide size_t IS defined
                        > in stdlib.h and NOT in a file included by it.
                        >
                        > Obviously I can't post the include files in there entirety since they
                        > are copyright, so you can either believe me, buy a copy of AIX and it's
                        > development system, or call me a lier.
                        >
                        >[color=green][color=darkred]
                        >>>>>>The stdlib.h distributed with gcc version 3.2
                        >>>>>>include s stddef.h to define size_t. I get
                        >>>>>
                        >>>>>That's nice. It doesn't have to.
                        >>>>
                        >>>>Did I say differently?
                        >>>
                        >>>Yes. I said:
                        >>>
                        >>>
                        >>>>>>>Where is the definition for size_t?
                        >>>>>>
                        >>>You said:
                        >>>
                        >>>
                        >>>>>>In a header file included by stdlib.h
                        >>>>>
                        >>>It doesn't have to be. It *could* be defined in stdlib.h.[/color]
                        >>
                        >>I never said differently.
                        >>But the fact that size_t *could* be defined in stdlib.h itself
                        >>does *not* mean that size_t *is* defined in stdlib.h itself.[/color]
                        >
                        >
                        > You said "In a header included by stdlib.h" not "Possibly in a header
                        > included by stdlib.h" so you have definitely been proved wrong. since on
                        > AIX 4.3 it IS defined in stdlib.h and NOT in any headers included by
                        > stdlib.h.[/color]

                        I stand corrected. I ammend my assertion to
                        "size_t is defined in a header file included by stdlib.h
                        except for the IBM AIC or AIX compiler."

                        Comment

                        • Richard Heathfield

                          #57
                          Re: Header include order

                          E. Robert Tisdale wrote:
                          [color=blue]
                          > CBFalconer wrote:
                          >[/color]
                          <troll banners>[color=blue]
                          >
                          > Evidently, your definition of a troll is anyone who disagrees with you.[/color]

                          No. I have disagreed with Chuck on many occasions, and yet he has never
                          called me a troll. Therefore, your statement is incorrect.
                          [color=blue]
                          > For you, it's just another epithet that you hurl at an opponent.[/color]

                          No. He just hurls it at trolls.
                          [color=blue]
                          > You resort to ad hominem attacks[/color]

                          Loads of people have tried reasoning with you. It never works, because you
                          blithely ignore almost every criticism people make. So in the end, lots of
                          people stopped bothering.

                          Now that we know you respond to cartoons, expect more cartoons.
                          [color=blue]
                          > when you have lost an argument
                          > and have no valid argument to contribute to the discussion.[/color]

                          Oh, we have plenty of valid arguments, stretching back many years. When are
                          you planning to deal with those arguments?
                          [color=blue]
                          > The use of such an obviously fallacious argument shows contempt
                          > for subscribers if you really expect to sway them with it.[/color]

                          It was a cartoon, not an argument. We've done the arguments already.
                          [color=blue]
                          > Or do you honestly believe that you are making a valid argument?[/color]

                          We've made loads. Google for almost any comp.lang.c thread containing the
                          word "Tisdale" for a whole bunch of reasons why you are wrong.

                          --
                          Richard Heathfield : binary@eton.pow ernet.co.uk
                          "Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
                          C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
                          K&R answers, C books, etc: http://users.powernet.co.uk/eton

                          Comment

                          • Mark Gordon

                            #58
                            Re: Header include order

                            On Mon, 24 Nov 2003 17:49:25 -0800
                            "E. Robert Tisdale" <E.Robert.Tisda le@jpl.nasa.gov > wrote:
                            [color=blue]
                            > Mark Gordon wrote:[/color]

                            <snip>
                            [color=blue][color=green]
                            > > Since according to you the GCC headers are copyright Sun, perhaps
                            > > you will accept a header copyright IBM that was distributed with
                            > > either AIC or the AIX compiler?[/color][/color]
                            ^^^ AIX

                            <snip>
                            [color=blue]
                            > I stand corrected. I ammend my assertion to
                            > "size_t is defined in a header file included by stdlib.h
                            > except for the IBM AIC or AIX compiler."[/color]

                            How do you know there is no other implementation where size_t is not
                            defined in stdlib.h?

                            Just accept that you were wrong in your assertion
                            and that you are wrong to claim to know what every single
                            implementation of C does.
                            --
                            Mark Gordon
                            Paid to be a Geek & a Senior Software Developer
                            Although my email address says spamtrap, it is real and I read it.

                            Comment

                            • E. Robert Tisdale

                              #59
                              Re: Header include order

                              Mark Gordon wrote:
                              [color=blue]
                              > How do you know that there is no other implementation
                              > where size_t is not defined in stdlib.h?[/color]

                              How do you know that there *is* another implementation
                              where size_t is not defined in stdlib.h?

                              Comment

                              • Richard Heathfield

                                #60
                                Re: Header include order

                                E. Robert Tisdale wrote:
                                [color=blue]
                                > Mark Gordon wrote:
                                >[color=green]
                                >> How do you know that there is no other implementation
                                >> where size_t is not defined in stdlib.h?[/color]
                                >
                                > How do you know that there *is* another implementation
                                > where size_t is not defined in stdlib.h?[/color]

                                And this kind of silly argument is /precisely/ why we go by What The
                                Standard Says.

                                The Standard, in this case, requires stdlib.h to declare the size_t type,
                                but neither forbids it from doing so, nor requires it to do so,
                                specifically by including some other header. Therefore, it is foolish for
                                us to write C code that relies either on the inclusion, or on the
                                non-inclusion, by stdlib.h of some other header for that declaration.

                                --
                                Richard Heathfield : binary@eton.pow ernet.co.uk
                                "Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
                                C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
                                K&R answers, C books, etc: http://users.powernet.co.uk/eton

                                Comment

                                Working...