[fpc-pascal] even linus torvalds prefer pascal over c

Daniël Mantione daniel.mantione at freepascal.org
Sat Dec 2 20:35:49 CET 2006

Op Sat, 2 Dec 2006, schreef John Coppens:

> On Sat, 2 Dec 2006 19:39:34 +0100 (CET)
> Daniël Mantione <daniel.mantione at freepascal.org> wrote:
> > However, assembler coded is not portable. A hand optimized Pascal 
> > based solution with goto statements might be preferable over assembler 
> > code. For example, in the file rtl/unix/video.pp , the procedure 
> > update_vcsa uses a goto for speed reasons.
> Yes... I understand that, of course. But my arguments against this are:
> 1) Except the compiler writers, few people know what code is generated
>    for which source (should they know?). How do I know that a goto is
>    really translated as a jump?

You can compile with -a and check the generated assembler code.

>    I'm no expert, I did see that in many
>    cases ifs, cases, whiles etc, are sufficiently 'recoded' by the 
>    compiler such as to make it difficult to garantee that (or know if)
>    the goto is reached fast enough to matter.

Correct. Unless you are aggressively hand optimizing code, always rely on 
your compiler.

> 2) Compiler semantic analysis is evolving (I imagine), so I'd suspect
>    that optimising is also improving continuously...

Of course, and compilers can do really amazing optimizations today, 
sometimes beating hand-coded assembler code if it wasn't written with 
care. However, today, anno 2006, it is still not that hard to beat 
compilers with hand written assembler code.

> 3) I also believe that gotos are somewhat like guns. If they're available,
>    it's more probable that people shoot themselves in the foot (or worse).
> Mind, I don't want to remove gotos. I'm all for free choice. But I'm
> still very much a proponent to discourage its use for fledgling
> programmers.

Well, this is the very point Torvalds was trying to make in the cited 
discussion; he wants to use goto in Linux source code, because he 
considers it the right thing to do in certain situations.

Daniël Mantione

More information about the fpc-pascal mailing list