LWN.net Logo

GCC Explorer - an interactive take on compilation

GCC Explorer - an interactive take on compilation

Posted May 26, 2012 19:07 UTC (Sat) by ejr (subscriber, #51652)
In reply to: GCC Explorer - an interactive take on compilation by cmccabe
Parent article: GCC Explorer - an interactive take on compilation

A compiler cannot sanely know when errno is used. It's possible in some corner cases, but those aren't worth their time.


(Log in to post comments)

GCC Explorer - an interactive take on compilation

Posted May 26, 2012 22:30 UTC (Sat) by cmccabe (guest, #60281) [Link]

That's true, but I don't think it's relevant here.

Both printf and puts will set errno when there is an error writing to stdout. The man pages (at least the ones I have installed) are oddly silent about this topic. However, once you realize that both of these functions just turn around and call write() eventually, and write() sets errno, the behavior becomes clear.

tl;dr: errno is a pretty crazy interface, but it's not really a problem here

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