Free Republic
Browse · Search
General/Chat
Topics · Post Article


1 posted on 07/19/2009 12:00:04 PM PDT by Ernest_at_the_Beach
[ Post Reply | Private Reply | View Replies ]


To: ShadowAce

fyi


2 posted on 07/19/2009 12:00:42 PM PDT by Ernest_at_the_Beach (Support Geert Wilders)
[ Post Reply | Private Reply | To 1 | View Replies ]

To: Ernest_at_the_Beach

0 N035!!!!

Guess I’d better get Windows 7 pretty quick, then.


4 posted on 07/19/2009 12:11:45 PM PDT by martin_fierro (< |:)~)
[ Post Reply | Private Reply | To 1 | View Replies ]

To: Ernest_at_the_Beach

BFL


7 posted on 07/19/2009 12:16:24 PM PDT by Attention Surplus Disorder (What kind of organization answers the phone if you call a suicide hotline in Gaza City?)
[ Post Reply | Private Reply | To 1 | View Replies ]

To: Ernest_at_the_Beach

Well, what do you expect from something coded in C/C++?


8 posted on 07/19/2009 12:40:11 PM PDT by OneWingedShark (Q: Why am I here? A: To do Justly, to love mercy, and to walk humbly with my God.)
[ Post Reply | Private Reply | To 1 | View Replies ]

To: Ernest_at_the_Beach

The problem is partly caused by the coder, partly by the compiler optimization.

The typical code fragment goes like this:

struct sock *sk = tun->sk;

(probably some more declarations and stuff)

if (!tun)
return POLLERR;

The compiler, seeing that the pointer ‘tun’ has already been read, assumes that the check for “!tun” (which would be the same as “tun != 0”) is redundant. This, however, isn’t true - the dereference to tun->sk would have returned gibberish if tun were == 0.

The solution is to put the dereference of tun->sk after the check.

A better solution would be for compilers to emit an error message when a pointer that has not been assigned a value is dereferenced - as in better, more strongly typed languages like Ada.

It would be nice, tho, if all compilers based on the gcc/GNU toolchain could somehow emit a log of “this is what I did in the optimization phase” with the original source (not just the generated asm code) so that the programmer had some clue of changes being made to the code. In the old days, when the PL/I optimizing compiler was all the rage on IBM machines (the late 70’s and early 80’s), we had a joke “Does it.... or doesn’t it? Only your PL/I OPT compiler knows for sure” — because the damn compiler re-wrote so much code on the fly for you.

Another hyper-optimizing compiler that left more than one person scratching their head was the FORTH1 FORTRAN compiler on IBM machines - and Bliss-32 on VAX systems.


9 posted on 07/19/2009 12:51:40 PM PDT by NVDave
[ Post Reply | Private Reply | To 1 | View Replies ]

To: rdb3; Calvinist_Dark_Lord; GodGunsandGuts; CyberCowboy777; Salo; Bobsat; JosephW; ...

14 posted on 07/19/2009 8:01:16 PM PDT by ShadowAce (Linux -- The Ultimate Windows Service Pack)
[ Post Reply | Private Reply | To 1 | View Replies ]

Free Republic
Browse · Search
General/Chat
Topics · Post Article


FreeRepublic, LLC, PO BOX 9771, FRESNO, CA 93794
FreeRepublic.com is powered by software copyright 2000-2008 John Robinson