"I see it as". If it's open to interpretation it's not that well
self-documented :)
On 10/8/2010 5:54 PM, Brandon S Allbery KF8NH wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> On 10/8/10 13:48 , Michael Tiernan wrote:
>> - "Tom Limoncelli" wrote:
>>> I see this in code now
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 10/8/10 13:48 , Michael Tiernan wrote:
> - "Tom Limoncelli" wrote:
>> I see this in code now and then:
>> 1<<16-1
>
> Being just a system geek and not a professional programmer, I don't
> understand why one would use that nota
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 10/8/10 11:07 , Andrew Hume wrote:
> bill said
(elided to preserve what sanity might be left in readers)
My headache just got a *lot* worse
- --
brandon s. allbery [linux,solaris,freebsd,perl] allb...@kf8nh.com
system administrator
Usually you see this in a data structure:
x = [
1<<8-1,
1<<16-1,
1<<24-1,
1<<32-1,
]
That is a lot easier to read than 0x8000 (etc)
Tom
--
http://EverythingSysadmin.com -- my blog (new posts Mon and Wed)
http://www.TomOnTime.com -- my advice (more videos coming soon)
> typedef enum {
> CODE_BLUE,
> CODE_RED
> } Code;
>
> extern Code condition;
> void check_condition() {
> if (condition = CODE_RED) {
> launch_missiles();
> }
> }
:-)
I may have to go dust off my copy of _C Traps and Pitfalls_ by Andrew Koenig, a
volume I heartily recommen
it falls under the category of "being (too) clever".
i did consider "lazy", as when you see
x = ~0;
or
x = 0^0;// this looks funny too!
but it is too specific to a 16 bit mask.
On Oct 8, 2010, at 10:48 AM, Michael Tiernan wrote:
- "Tom Limoncelli"
There's always this one, which I ran into at some point and thought was
just lovely. No, I didn't do this, and no, I can't take credit for making
it up either...I can't even remember where I first saw it, and yes, I
could use Google to find it (Hi, Tom! :)).
typedef enum {
CODE_BLUE,
C
at first i wanted to say that this programmer never had
to deal with 16 bit ints. but charmingly, it even works for 16 bit ints.
(because the 1<<16 == 0, and -1 == 0x).
On Oct 8, 2010, at 10:27 AM, Tom Limoncelli wrote:
I see this in code now and then:
1<<16-1
Python and C
- "Tom Limoncelli" wrote:
> I see this in code now and then:
> 1<<16-1
Being just a system geek and not a professional programmer, I don't understand
why one would use that notation instead of the more obvious variations of
"0x8000"?
I understand that the compiler, at compi
On Fri, Oct 8, 2010 at 1:27 PM, Tom Limoncelli wrote:
> I see this in code now and then:
>
> 1<<16-1
>
> Python and C interpret that as "1 << (16 - 1)", which is 32768.
>
> The programmer usually means "(1 << 16) - 1", which is 65535.
>
> There's a big difference, especially if you
I see this in code now and then:
1<<16-1
Python and C interpret that as "1 << (16 - 1)", which is 32768.
The programmer usually means "(1 << 16) - 1", which is 65535.
There's a big difference, especially if you are using these for bit masks:
32768 = 1000
65535 = 111
On Oct 8, 2010, at 11:22 AM, Randal L. Schwartz wrote:
>
>enum boolean {
> true,
> false,
> file_not_found,
>};
I've always preferred:
enum boolean {
true,
false,
maybe,
};
-C
___
Tech mailing list
Tech@lo
That is just... special.
I mean, I've seen some funny comments before, but nothing that was
*that* awful...
// FIXME: what do we do here?
// FIXME: the following line is scary.
// FIXME: the following 2 functions totally suck, are useless and
should be replaced immediately.
// FIXME: Do we car
> "Andrew" == Andrew Hume writes:
Andrew> ignoring logic errors (we really wanted hour from teh epoch, and not
Andrew> hour of teh day) and time errors (ctime does localtime, not UTC);
Andrew> my question is, where does someone learn this technique?
They read thedailywtf.com, not realizing t
Oh the pain! Make it stop!!
--
http://EverythingSysadmin.com -- my blog (new posts Mon and Wed)
http://www.TomOnTime.com -- my advice (more videos coming soon)
___
Tech mailing list
Tech@lopsa.org
http://lopsa.org/cgi-bin/mailman/listinfo/tech
This l
i've come across something odd, and was wondering
if anyone else had seen this before.
we have an internal (uint64) timestamp which is the number of
milliseconds since teh epoch UTC. Bill (a pseudonym) needed
to find out what hour a specific timestamp t corresponded to.
now i would have just sai
16 matches
Mail list logo