>>1 main() {
fork();
void *a = malloc( 1024 );
void *b = malloc( 1024 );
free( b );
free( a );
}
Assuming there's only 2048 bytes of memory available, can you see a fairly obvious deadlock? It's easier to have it remain synchronous. If you're really serious about it,
void *awesum_malloc( size_t s ) {
void *blob = malloc( s );
if ( blob )
return blob;
sleep( 10 );
return awesum_malloc( s );
}
>>8,9
The only way to know about the -Ox flags is to wade through a thousand page man page, or by word of mouth. If it doesn't do it by default, then any mechanism which provides the functionality is obscure.
Name:
Anonymous2008-10-18 19:08
>>10
The only way to know about the gcc command is to wade through a thousand page man page, or by word of mouth. If it doesn't do it by default, then any mechanism which provides the functionality is obscure.
Name:
Anonymous2008-10-18 19:18
Requiring a compiler-specific feature is bs, but why does it matter, it's trivial to rewrite awesum_malloc to a plain loop
>>11
Way to completely misunderstand my point. I'm specifically talking about command-line options. What if you were used to using Visual Sepples, and you had to use gcc for some cross-platform stuff. How would you know whether or not tail calls are implemented, or how to get the compiler to generate tail calls?
Name:
Anonymous2008-10-18 20:04
>>13 here. Just so we're clear, I wouldn't normally use gcc, nor will I ever use a GPL'd piece of software in my life, simply because all GPL'd code is shit. It's as simple as that.