Article View: comp.sys.powerpc
Article #3138Re: Debate: PowerMac "trounces" Pentium....???
From: Nevin ":-]" Liber
Date: Tue, 20 Feb 1996 04:03
Date: Tue, 20 Feb 1996 04:03
34 lines
2746 bytes
2746 bytes
In article <danpop.824475697@rscernix>, danpop@mail.cern.ch (Dan Pop) wrote:
> >Like I said, this stuff isn't that easy to get right and 100% portable.
> It's definitely portable, because buff doesn't have to be statically
> allocated. It's trivial to compute the maximum size of buff, based on
> sizeof(int) and allocate the right number of bytes for buff (ever heard
> of the malloc thingie?).
Of course, you didn't even know this was an issue until I pointed it out.
I notice that you don't post the code to do that calculation here. Also,
it is lousy programming to incur a run-time cost for something that is a
known quantity at compile time.
> It's easy to get it right and 100% portable for any C programmer with half
> a clue.
Well, I guess you don't have half a clue, since you *didn't* post the code
that gets this 100% correct and portable. A bunch of handwaving with your
malloc comment just doesn't cut it. If it's so darn trivial to compute
the maximum size of buff, why don't you provide a compile-time expression
that evaluates to it? Another thing you failed to mention (I know, you're
gonna claim that it is so trivial that it doesn't need mentioning to cover
up the fact that you didn't even consider it) is that the maximum size of
buff is also dependent on the number of bits per byte. Personally, I'm
not sure C is rich enough to support this, since it requires being able to
take the log of a number at compile time. But, since you claim to know
better, why don't you post this compile-time expression for us?
The hard part about writing portable code isn't the complexity of the
final result; it's making sure that you've taken all the issues into
account, because your compiler won't tell you when you haven't.
--
Nevin ":-)" Liber nevin@CS.Arizona.EDU (520) 293-2799
Technical Details
Message-ID:
<nevin-1902962104170001@150.135.1.79>Path:
arc1-ca.pugleaf.net!CS.Arizona.EDU!NewsWatcher!userReferences:
<nevin-0602962253080001@150.135.1.79> <4fdi45$gu7@eken.hv.se> <4fea7g$eio@nyx.cs.du.edu> <9602092127.AA24456@ues5.cern.ch> <nevin-1202960529130001@150.135.1.79> <9602121654.AA02634@ues5.cern.ch> <4fqdta$rhh@meaddata.lexis-nexis.com> <danpop.824303108@rsce <nevin-1502960049080001@150.135.1.79> <danpop.824475697@rscernix>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!CS.Arizona.EDU!NewsWatcher!user From: nevin@CS.Arizona.EDU (Nevin ":-]" Liber) Newsgroups: comp.sys.powerpc,comp.os.linux.advocacy,comp.sys.mac.advocacy,comp.os.os2.advocacy,comp.sys.amiga.advocacy,comp.sys.intel Subject: Re: Debate: PowerMac "trounces" Pentium....??? Date: Mon, 19 Feb 1996 21:03:37 -0700 Organization: University of Arizona CS Department, Tucson "It's too dang hot!" Arizona Message-ID: <nevin-1902962104170001@150.135.1.79> References: <nevin-0602962253080001@150.135.1.79> <4fdi45$gu7@eken.hv.se> <4fea7g$eio@nyx.cs.du.edu> <9602092127.AA24456@ues5.cern.ch> <nevin-1202960529130001@150.135.1.79> <9602121654.AA02634@ues5.cern.ch> <4fqdta$rhh@meaddata.lexis-nexis.com> <danpop.824303108@rsce <nevin-1502960049080001@150.135.1.79> <danpop.824475697@rscernix> NNTP-Posting-Host: mac-nevin.cs.arizona.edu X-Newsreader: Yet Another NewsWatcher 2.2.0b4