Dave

around

galos.no-ip.org

Age: 23

I love C. Java less.

Mar
5
awarded Good Answer
Feb
18
comment Minimal code CPU stress-tester…
if you use @ace's scanf trick, you can get this down to 39: main(a){for(scanf("%d",&a),alarm(a);;);}
Dec
9
comment Using MongoDB data inside Hadoop with the help of Morphia
The reason that questions persist is so that they can be helpful to others. This is a really bad way of doing this, and I want to indicate that to future viewers. I only found this question because I needed the answer for something I'm working on now.
Dec
9
comment Type "Hello, World!"
No need to call tty it only works if stdin is a tty, in which case, 0 is already an open terminal fd.
Dec
9
awarded Autobiographer
Dec
9
comment Should we check if memory allocations fail?
@harris !v is equally as valid as v == NULL
Dec
9
comment Using MongoDB data inside Hadoop with the help of Morphia
-1: This is not the way to do this. There is no need to serialize and unserialize your data just to perform such a trivial conversion
Dec
9
answered Using MongoDB data inside Hadoop with the help of Morphia
Jul
19
awarded Yearling
Jul
16
awarded Yearling
Jun
13
comment Are there any practical differences between constructing a string via strdup() and malloc()?
@VladLazarenko snprintf() always terminates the string, you are thinking about the strncpy(). It's the second pargraph in the manpage
Jun
11
awarded Popular Question
Apr
29
comment Build static ELF without libc using unistd.h from Linux headers
I did, but I also read the hand-waving you used to justify the 5K filesize. The dietlibc file, properly initialized and unstripped comes to 2.7K. I do find it interesting to see exactly how much glibc bloat is actually from the startup. I think that what you do could be more explicit from the start, and that -nostartfiles should be used rather than -nostdlib -lc
Apr
29
comment Build static ELF without libc using unistd.h from Linux headers
My point is that even write() is a "standard library" function and that not linking _start() is pretty much indefensible. And, if your binary is still 5K, then glibc's write() is absolutely bloated.
Apr
29
revised Build static ELF without libc using unistd.h from Linux headers
deleted 6 characters in body
Apr
29
answered Build static ELF without libc using unistd.h from Linux headers
Apr
29
comment Build static ELF without libc using unistd.h from Linux headers
-1: This absolutely brings in glibc with -lc. The solution to OP's problem is not to break glibc by not allowing it to initialize itself in a quest for smaller binary size. Instead an embedded libc like musl or dietlibc should be used.
Feb
15
awarded Yearling
Feb
3
awarded Good Answer
Dec
27
accepted Massive fprintf speed difference without "-std=c99"
1 2 3 4 5