|
|
Subscribe / Log in / New account

Quote of the week

I think people believe that the compiler will warn them something like: "warning: Assigning a subtract operation to an unsigned!" but the compiler is never going to do that. Unsigned is just a declaration that "I'm never going to be surprised so let's make this stuff more dangerous and fun!"
Dan Carpenter

to post comments

Quote of the week

Posted Jun 3, 2021 18:28 UTC (Thu) by davecb (subscriber, #1574) [Link] (2 responses)

Reminds me of B, where I could do a floating-point multiply on a word that happened to contain an int. I was rather pleased when Honeywell started switching over to C (;-))

Quote of the week

Posted Jun 4, 2021 0:22 UTC (Fri) by Paf (subscriber, #91811) [Link] (1 responses)

Oh, that sounds like ... fun.

Quote of the week

Posted Jun 4, 2021 13:27 UTC (Fri) by khim (subscriber, #9252) [Link]

I haven't worked with B, but used FORTH with the exact same property. It's much less “fun” than modern C or C++.

Because in languages like B or FORTH the typical situation is “I had million lines of code which worked, I have added ten lines of code and program no longer works — let me spend couple of hours to see what's wrong with these 10 lines”. But with modern C/C++ it's “I had million lines of code which worked, I have added ten lines of code and program no longer works — let me spend couple of months to see what's wrong with these million lines and what exactly allowed compiler to screw me up again optimize my code in unexpected way”.

Quote of the week

Posted Jun 7, 2021 11:44 UTC (Mon) by guus (subscriber, #41608) [Link]

It doesn't matter if you have unsigned or signed integers, but as soon as you subtract two numbers of a given type, it is no longer guaranteed to fit in that type; you always need one bit more. There are lots of situations where you do want to subtract two unsigned numbers where you know for sure which one is bigger, and you don't want the compiler to start warning about perfectly valid uses.


Copyright © 2021, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds