Re: completed my Varaint class.

From: Mike Wahler (mkwahler_at_mkwahler.net)
Date: 01/26/04


Date: Mon, 26 Jan 2004 07:04:45 GMT


"Chris ( Val )" <chrisval@bigpond.com.au> wrote in message
news:bv2c8o$napd7$1@ID-110726.news.uni-berlin.de...
>
> "Mike Wahler" <mkwahler@mkwahler.net> wrote in message
> news:5f2Rb.27136$1e.11002@newsread2.news.pas.earthlink.net...
>
> [snip]
>
> Hi Mike.
>
> | > - Taken from Richard' post:
> | >
> | > -----------------------------------
> | > 7.17 Common definitions <stddef.h>
> | > -----------------------------------
> | > 1 The following types and macros are defined in the standard
> | > header <stddef.h>. Some are also defined in other headers, as
> | > noted in their respective subclauses.
> | > -------------------------------------------------------------
> | >
> | > The problem I have here, is the keyword *Some*.
> | >
> | > Because when you look at the *Some* of the examples Richard
> | > posted, the keyword used is now *declared* - a declaration is
> | > not always a definition, and visa versa right ?
> |
> | I think Leor has already covered the above well enough.
>
> Yes, but there is still a little doubt in my mind due
> to that wording :-).

Well, it's getting late here, and I believe I'm probably
too tired to review this thread again right now. Maybe
tomorrow (unless someone else can clear things up first).

>
> | > Besides, Greg Comeau agrees with me :-).
> | >
> | > Taken from his 'Tech Talk FAQ:
> | > -------------------------------------------------------
> | > How to get the dimension/bounds of an array?
> | > Consider:
> | > #define BOUNDS(array) sizeof(array) / sizeof(array[0])
> | > // ...
> | > char buf[99];
> | > // ...size_t is from stddef.h in C, cstddef in C++
> | > size_t bd = BOUNDS(buf);
> |
> |
> | But that doesn't mean it's *not* declared in other
> | headers. I seriously doubt Greg will say that 'size_t'
> | is not also declared by those other headers.
>
> Right, but I didn't say that they couldn't be, nor did I
> mean that Greg would imply that. What I meant was, that
> given the choice(and I'm sure Greg is aware that the other
> headers declare it), Greg has decided upon what I think is
> the correct header.

I suppose I'm really objecting to your use of the word 'correct'
here. Of all of them that declare 'size_t', none is more or
less 'correct' than the other.

>
> |I tend to use <stdlib.h> when I need 'size_t'.
>
> That's fine I guess.
>
> | Often I'll #include <string.h> for the C-style string stuff,
> | but I'll also still #include <stdlib.h> for 'size_t'.
> | This is simply because I always seem to forget that <string.h>
> | also declares 'size_t'. I think the best thing is what you
> | and I both seem to do: pick our 'favorite' header for 'size_t'
> | and use it consistently.
>
> Yes indeed.
>
> I have always used <cstddef> in C++, and it is the one I'll
> continue to use consistently :-).

stdlib, stdlib, nyah, nyah! :-)

-Mike



Relevant Pages

  • Re: completed my Varaint class.
    ... |> mean that Greg would imply that. ... |> headers declare it), Greg has decided upon what I think is ... | stdlib, stdlib, nyah, nyah! ...
    (alt.comp.lang.learn.c-cpp)
  • Re: completed my Varaint class.
    ... Some are also defined in other headers, ... |> Because when you look at the *Some* of the examples Richard ... I seriously doubt Greg will say that 'size_t' ... headers declare it), Greg has decided upon what I think is ...
    (alt.comp.lang.learn.c-cpp)
  • Re: completed my Varaint class.
    ... Hi Mike and Richard. ... |> It's true, that those headers may declare them, but I ... |> and its type (an unsigned integer type) is size_t, ...
    (alt.comp.lang.learn.c-cpp)
  • Re: all those Xstreams
    ... > Mark wrote: ... of iostream headers and which types they declare. ... You're confusing types with headers. ... types 'istream' and 'ostream' are declared, ...
    (alt.comp.lang.learn.c-cpp)
  • Re: returning error from main()
    ... there are functions which are saner than their ISO C ... M$'s standard C headers only declare them (or some of them, ...
    (comp.lang.c)