[fpc-devel] Const optimization is a serious bug
Hans-Peter Diettrich
DrDiettrich1 at aol.com
Sat Jul 9 19:55:38 CEST 2011
Chad Berchek schrieb:
> Wow, thanks for the insults guys. I didn't realize I was so stupid.
Waking up? ;-)
> You missed my point too, BTW. According to the link given:
>
> "A constant argument is passed by reference if its size is larger than a
> pointer."
People like you should not read such detailed explanations, which they
tend to misinterpret :-(
> So you always know what the size of a pointer is? If I have this record:
>
> TMyRec = record
> I: Integer;
> end;
>
> Is that passed by value or ref? Is someone compiling on 32-bit or 64?
> You don't know, and neither does anyone. And that is my point about why
> having it defined is important.
NACK. Most languages have some vague specifications, like the size of
int or Integer. This is *intentional*, and every coder should write his
code in a way, that it works under all allowed circumstances.
> I guess my brain is way to tiny to get past the notion that a "write
> once, compile anywhere" programming language should be defined in such a
> way that the meaning of the program doesn't spontaneously change
> depending on the compilation platform.
It's up to YOU to make your code behave properly on every platform. If
you assume e.g. a specific byte order, your code can crash on any other
platform, regardless of the programming language you choose.
DoDi
More information about the fpc-devel
mailing list