[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: pcb crooked traces



On Wed, Oct 13, 2010 at 12:59:42AM +0200, Karl Hammar wrote:
> Peter Clifton:
> > 
> > The compiler will (correctly) sign-extend the assigned value in str when
> > performing the type conversion.
> 
> Close, but you missed to point out that a char is signed on my box.
> It could as well be unsigned, but then the problem would not show up.
>

Well, that is an oddity of the C language, not an oddity of integer
computer math in general. But I see your point.
 
> > I wasn't sure this was a question you already knew the answer two or
> > not.. but it is certainly a nice example of why you have to be careful
> > mixing different types, and signed-ness in general.
> 
> Yes, and there are portability issues also.
>

Again, the C language fails to define a lot of things (ironically, in
the name of portability) and therefore causes problems that can't be
properly blamed on the use of ints.

Many other languages do not pull this kind of crap, though they still
do unintuitive things regarding overflow and sign extension.
 
-- 
Andrew Poelstra
Email: asp11 at sfu.ca OR apoelstra at wpsoftware.net
Web:   http://www.wpsoftware.net/andrew/



_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user