LWN.net Logo

Why learn C? (O'Reilly Radar)

Why learn C? (O'Reilly Radar)

Posted Jul 1, 2012 22:24 UTC (Sun) by nix (subscriber, #2304)
In reply to: Why learn C? (O'Reilly Radar) by HelloWorld
Parent article: Why learn C? (O'Reilly Radar)

To be fair, returning structures was poorly supported once. Of course that was in about 1980, but it explains some properties of the standard C and POSIX library (e.g. why stat() does not return a 'struct stat').


(Log in to post comments)

Why learn C? (O'Reilly Radar)

Posted Jul 1, 2012 22:38 UTC (Sun) by juliank (subscriber, #45896) [Link]

I'd say another reason is that it's much easier to check for errors if your function returns some integer and passes the real result via a pointer.

Why learn C? (O'Reilly Radar)

Posted Jul 2, 2012 9:29 UTC (Mon) by nix (subscriber, #2304) [Link]

Well, if there's only one error, it's easier to use the function if you just return the pointer or NULL.

Structures and results

Posted Jul 12, 2012 16:44 UTC (Thu) by alex (subscriber, #1355) [Link]

Or to emulate old-school styles return NULL and set the global errno ;-)

Why learn C? (O'Reilly Radar)

Posted Jul 12, 2012 20:04 UTC (Thu) by hummassa (subscriber, #307) [Link]

HRESULT feelings.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds