Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #2035

Language standards vs. implementation, was Re: A right alternative to IEEE-754's format

From "Quadibloc" <jsavard@ecn.ab.ca>
Newsgroups comp.compilers
Subject Language standards vs. implementation, was Re: A right alternative to IEEE-754's format
Date 2018-04-01 12:06 -0700
Organization Compilers Central
Message-ID <18-04-005@comp.compilers> (permalink)
References <2018Apr1.144759@mips.complang.tuwien.ac.at>

Show all headers | View raw


 [[ this string is copied from comp.arch because your moderation found it interesting ]]

It is legitimate to say that if a language specification states,
explicitly, that if you do such-and-so, what might happen is not
specified (undefined) or may vary from one machine and compiler to
another (implementation-dependent), then, as this is a thing that cannot
be relied upon, it may be dispensed with if that helps the compiler
generate faster code.

But it is also the case that many C programmers have, for a long time,
been using compilers which did not have advanced optimization
technology, so that certain now undefined behaviors could be relied upon.

Not to mention that the language specification has been updated over the years.

Having to use a special compiler option to make old programs work...
is better than nothing, but I can understand why it is felt to be not good enough.

On the other hand, changing the language spec so that all the old
tricks still work - at the cost of reducing the available level of
optimization for programs that don't use any tricks - well, I can see why that's rejected too.

As I've pointed out before, it seems like both sides could only be made
happy if each side had its own language to define.

But that has its own problem; one side, at least, will lose the
benefits of its language being C, the universal language!

Well, here's an idea. It's unlikely to be adopted, because it will be
viewed as a victory for your side.

Define C as offering, explicitly in its definition, all those behaviors
that programmers of old relied upon. Define subset C as a well-behaved
language without that stuff, that is as easy to optimize as Pascal or FORTRAN.

When you turn up the optimization switch on a compiler, that is not to
change which language it compiles. If you have a program in Subset C, you
have to use a different compiler switch to say so - and then the
various optimization levels will likely run faster.

There. Everyone happy.

Back to comp.compilers | Previous | Next | Find similar


Thread

Language standards vs. implementation, was Re: A right alternative to IEEE-754's format "Quadibloc" <jsavard@ecn.ab.ca> - 2018-04-01 12:06 -0700

csiph-web