On C/C++ undefined behaviours

Andrej Mitrovic andrej.mitrovich at gmail.com
Fri Aug 20 10:04:41 PDT 2010


What are these Java programs for the desktop that run fast? I haven't
encountered any, but maybe that's just because I didn't try them all
out. Eclipse takes at least 20 seconds to load on startup on my quad
core, that's not very fast. On the other hand, CodeBlocks which is
coded in C++ and has  a few dozen plugins installed runs in an
instant.

Just firing up a dialog in eclipse takes a good second, maybe two. So
give me the names of those fast Java applications, pls. :)

On Fri, Aug 20, 2010 at 6:38 PM, bearophile <bearophileHUGS at lycos.com> wrote:
> Three good blog posts about undefined behaviour in C and C++:
> http://blog.regehr.org/archives/213
> http://blog.regehr.org/archives/226
> http://blog.regehr.org/archives/232
>
> In those posts (and elsewhere) the expert author gives several good bites to the ass of most compiler writers.
>
> Among other things in those three posts he talks about two programs as:
>
> import std.c.stdio: printf;
> void main() {
>    printf("%d\n", -int.min);
> }
>
> import std.stdio: writeln;
> void main() {
>    enum int N = (1L).sizeof * 8;
>    auto max = (1L << (N - 1)) - 1;
>    writeln(max);
> }
>
> I believe that D can't be considered a step forward in system language programming until it gives a much more serious consideration for integer-related overflows (and integer-related undefined behaviour).
>
> The good thing is that Java is a living example that even if you remove most integer-related undefined behaviours your Java code is still able to run as fast as C and sometimes faster (on normal desktops).
>
> Bye,
> bearophile
>


More information about the Digitalmars-d mailing list