[freetds] Return error proposal

James K. Lowden jklowden at freetds.org
Wed Dec 17 11:01:55 EST 2008


Frediano Ziglio wrote:
> I personally never liked things
> like errno and returning a true/false for errors. Why not using a bit
> to distinguish error from success?? 

Hi Freddy, 

Plauger comments on this in his book on the standard C library.  He says
error processing is hard and that errno, while it looks messy, has
survived despite many suggested (even obvious) alternatives because it
works.  

> For instance >= 0 for success and
> < 0 for error. 

It requires bit-twiddling to get at the real error. 

> But now even
> tds_connect_and_login return the error. Personally also I don't like
> an oserr in TDSSOCKET, errno usually don't have problems with thread
> on multi-threaded safe environment (that is major ones) but this errno
> have threads problems. 

I'm unconvinced.  The db-lib error handler passes oserr.  Surely we can
copy a value to a tread-safe location for later inspection.  You can't
pass an "errno is valid" flag because subsequent libc calls change errno. 


Happy to discuss.  :-)

Regards, 

--jkl



More information about the FreeTDS mailing list