🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #2827

Speaking of _lread (was: Re: _lread doesn't respect O_TEXT)

#2827
From: Kent Forschmiedt
Date: Thu, 23 May 1991 21:14
29 lines
1670 bytes
_lread() ans _lwrite() are misdeclared in windows.h.  They are
declared as WORD, which means unsigned int, which means the compiler
believes that they cannot return -1, which they must do to report
an error.  If you compile with -W2 under C6.0x, which is apparently
the convention in microsftland, the compiler will quietly reduce
things like:

if (_lwrite(...) < 0) {
	// do something about it
}

to:

_lwrite(...)

because an unsigned cannot be less than zero.  If you use -W3 it will
tell you that it is breaking your code.

The sample dib code in the SDK depends on this misdeclaration; if you
correct the declaration in windows.h, the sample code will break.  I
suspect that there is other similarly broken code floating around microsoft.
Do you suppose Excel would pass lint?  nyuk nyuk nyuk

I think it's kind of cute the way they turn off the warning messages
that the compiler generates.  I knew a guy once who disconnected
the oil pressure warning light from his engine because he didn't like
it shining there on his dashboard.  Guess what happened to his motor?
-- 
Kent Forschmiedt ... kentfo@polari ... uw-beaver!sumax!polari!kentfo
Technical Details
Message-ID: <4190@polari.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!zaphod.mps.ohio-state.edu!caen!dali.cs.montana.edu!milton!sumax!polari!kentfo
References: <1991May15.000959.4668@world.std.com> <72463@microsoft.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!zaphod.mps.ohio-state.edu!caen!dali.cs.montana.edu!milton!sumax!polari!kentfo
From: kentfo@polari.UUCP (Kent Forschmiedt)
Newsgroups: comp.windows.ms.programmer
Subject: Speaking of _lread (was: Re: _lread doesn't respect O_TEXT)
Message-ID: <4190@polari.UUCP>
Date: 23 May 91 21:14:04 GMT
References: <1991May15.000959.4668@world.std.com> <72463@microsoft.UUCP>
Organization: Seattle Online Public Unix (206) 328-4944
Lines: 29