[LCP]sizeof question.
David
filiond at videotron.ca
Sat Sep 21 05:01:02 UTC 2002
Greg Black wrote:
>
> David wrote:
>
> | A wrote:
> | > On Friday 20 September 2002 2:48 pm, you wrote:
> | > #
> | > # I added the case because the compiler complains if I don't.
> | > # SUN Workshop, not gcc :(, unfortunaltly.
> | >
> | > That is most likely because you have missed out
> | > #include<stdlib.h>
> | > which includes the prototype for the malloc family. With this missed out the
> | > compiler assumes that the return type will be int and therfore requires the
> | > cast. This is the kind of error that gets masked with casts.
> |
> | Nope. It's there.
> | I added the case because the calloc is in C file that is being included
> | as part of a c++ project. It's the c++ compiler that bitches, not the C
> | compiler.
>
> I'm going to assume you mean "cast" in the various places where
> you wrote "case" -- this sort of carelessness, especially where
> both words are technical words, makes it difficult to help.
>
> Anyway, to get to the point, you cannot compile C correctly with
> a C++ compiler. They are different languages and have different
> rules. There is legal C code which is not legal C++; and there
> is legal C++ code which is not legal C. And there are things
> that, although legal in both languages, do not have the same
> meaning. C and C++ have very different requirements for casts.
>
> This is a C list. You have been given C answers. If you are
> trying to write C++, you need another list.
>
> Greg
I know they are different languages (the little ++ gives it away :).
If you read the original posting all I asked about was sizeof.
Not about casting, you brought that up.
If sizeof performs differently under c++ then say so and I will post my
question to the c++ list.
--
David Filion filiond[at]videotron[dot]ca
Linux counter #195143
"Yes, it's manly, but let's face it, so is bungee-jumping with the
cord tied to your testicles." -- Linus Torvalds
More information about the linuxCprogramming
mailing list