emperor: (Axe)
Add MemoryShare This Entry

bah

posted by [personal profile] emperor at 02:54pm on 15/03/2006 under , ,

In bygone days, if you wanted as big an integer type as the system allowed, you'd declare it long int foo; or maybe unsigned if you wanted a bit more space, and didn't care about negative numbers. You could, should you wish to print such a number, then say printf("%ld\n",foo);, and all was good. On many systems, long was a 32-bit type. Foolish people would rely on this, and indeed on a long being no more than 32 bits long.

Time went by, and 32 bits just weren't enough. For some programs, 64-bit integers were necessary. One approach would have been to say "on our platform, long will be 64 bits", but that would have messed up those foolish people I mentioned above. Instead, C99 came up with a complex mess. You can have long long int, but that's not guarunteed to be any particular size, or you can have int64_t and friends - a whole mishmash of types. What you almost certainly cannot use is long int - all that correct code that assumed that long would be the biggest type available is now broken.

As if that wasn't enough, all these new types are horrible to print out. For an unsigned 64-bit integer (uint64_t), the above rune has to become printf("%" PRIu64 "\n",foo); instead, which is just plain ugly. Who came up with this shit?

While I'm at is, solaris 9 sucks, too. Its libc lacks a whole pack-load of useful C99 features, its gdb can't cope with 2.4G core files (and, indeed, many of its utilities don't deal with large files). Bah. I'd upgrade to solaris 10, but a) that would take lots of time and b) I'd lay you good odds the entire system (or at least the Oracle install) would break dismally, and we have no on-site solaris admins.
There are 6 comments on this entry. (Reply.)
 
posted by [identity profile] mobbsy.livejournal.com at 04:47pm on 15/03/2006
Oracle shouldn't mind, or at worst it'll just be a quick relink of the binaries.
 
posted by [identity profile] deliberateblank.livejournal.com at 08:42pm on 15/03/2006
gdb just plain doesn't work, and as far as my experience goes, never has.

I expect a debugger to be able to set breakpoints and single-step (both source level and assembly), for example.
pm215: (Default)
posted by [personal profile] pm215 at 09:13pm on 15/03/2006
I'm impressed that you've encountered a gdb that's that broken. Usually they do odd things in the edge cases (eg mangled stack frames on ARM or trying 'set follow-fork-mode child' or debugging multithreaded programs). But your basic breakpoint and singlestep stuff is generally fine.
 
posted by [identity profile] deliberateblank.livejournal.com at 09:30pm on 15/03/2006
It *occasionally* works for me. But tends to forget and run on, usually straight into the crash I'm trying to dissect.

I'm getting used to debugging without an interactive symbolic debugger again. Years since I've had to do that, and it's *so* much slower.
 
posted by [identity profile] deliberateblank.livejournal.com at 09:32pm on 15/03/2006
It is, by the way, the default and up-to-date FC3 gdb running on a P4 Xeon.
pm215: (Default)
posted by [personal profile] pm215 at 10:20am on 17/03/2006
How strange. I think if it did that to me more than about three times I'd stop what I was doing and start debugging gdb...

August

SunMonTueWedThuFriSat
          1
 
2
 
3
 
4
 
5
 
6
 
7
 
8
 
9
 
10 11
 
12
 
13
 
14
 
15
 
16
 
17
 
18
 
19
 
20
 
21
 
22
 
23
 
24
 
25
 
26
 
27
 
28
 
29
 
30
 
31