The OP says it throws a seg fault when compiled with gcc, but not with Turbo C. I'd say this suggests gcc is a better compiler than Turbo C (this is indeed the case in reality -- gcc is actively maintained and significanly more standard-conforming than Turbo C).
That, that the gcc generated executable crashes, is a good thing. That, that the Turbo C generated executable apparently works is a terrible thing.
Of course, with a JVM interpreting byte code over a sand-box, different Java implementations do not pose such inconsistencies to the beginner.
Joined: Oct 13, 2005
Thank you. But a Java™ virtual machine is more tightly controlled; the Java™ Language Specification is strict about lots of things, eg the behaviour of i = i++; So the behaviour of different JVMs should be more similar to one another.
You are right. C and C++ leaves a lot unspecified (or undefined or allows the implementation to specify/define) whereas the JLS does not.
And no worries regarding "delay in replying". It is amazing what you folks (sheriffs, moderators, and other active members) contribute and how you find the time to do so. Thank you and everyone in the Ranch for that.