|
|
Chambers wrote:
> Darren New wrote:
>> You can't accidentally declare the function taking a float in the
>> headers and an integer in the body and have mysterious type crashes at
>> runtime in spite of your static typing.
>
> C++ won't let you do that, either.
Really?
So if I have a class declared as
A.h:
class A { int X; float Y; }
A.c:
void makeAlpha(A* alpha) {
alpha.X = 27;
alpha.Y = 82.3;
}
B.c:
void useAlpha() {
A alpha;
makeAlpha(&alpha);
printf("%d\n", alpha.X);
}
And I compile A.c, then change A.h to put the member variables in the
opposite order, then compile B.c, and link the results together, you're
telling me the C++ standard tells me that shouldn't link?
I'm impressed.
--
Darren New / San Diego, CA, USA (PST)
"That's pretty. Where's that?"
"It's the Age of Channelwood."
"We should go there on vacation some time."
Post a reply to this message
|
|