venta: (Default)
[personal profile] venta
Note to self:

3 + 8 << 2

is not the same as

3 + (8 << 2)

That's an hour you just spent tracking down a bug based on a mistake you've made several times before.

Yes, I know, brackets. Normally I'm assiduous about brackets. But for short lines like, say,

3 + 8*2

I actually think they detract from readability.

I'm sure there are sound reasons why shift has precedence over addition in C, but I find it counter-intuitive in the extreme.

Maybe a nice dose of online mockery will help me remember in the future :(

Note to non-geeks:
Don't worry, not much to see here. I made a school-boy error.

Date: 2010-07-13 10:47 am (UTC)
ext_8103: (Default)
From: [identity profile] ewx.livejournal.com
Ah yes, code not already warning-clean can be a nightmare to tidy up l-(

Profile

venta: (Default)
venta

December 2025

S M T W T F S
 123456
78910111213
14151617181920
212223 24252627
28293031   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Dec. 27th, 2025 11:28 pm
Powered by Dreamwidth Studios