🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3574

Re: vprintf confusion?

#3574
From: Alan Stokes
Date: Mon, 31 Jul 1995 12:46
25 lines
1385 bytes
In <3v8ahp$3u0@ftcnews.nrcs.usda.gov> ute@feinde2.ftc.nrcs.usda.gov (Ute R. Willmore) writes:
>Richard A. O'Keefe (ok@goanna.cs.rmit.edu.au) wrote:
>: ute@feinde2.ftc.nrcs.usda.gov (Ute R. Willmore) writes:
>: >A rough pseudo code example:

>: >if (next value should be float)
>: >  array[i].val_ptr = calloc a double
>:                       ^^^^^^

>: This is not on your topic, but why on earth are you using calloc()?
>: Calloc() buys you precisely two things that malloc() doesn't:
>:  -- it takes longer
>:  -- it traps you into writing non-portable code.

>It also buys me initialized memory, and I need to ensure I don't have garbage
>in the array, since that will cause problems when I display the data later.

No, it doesn't. The effect of setting all bytes of a floating point type to 0
is undefined; it certainly doesn't in general set the floating point value
to 0.0. (That's what the second point above is talking about.)

-- 
Alan Stokes (alan@rcp.co.uk)
RCP Consultants Ltd
Didcot, UK
Technical Details
Message-ID: <KjQHwAuMBh107h@rcp.co.uk>
Path: arc1-ca.pugleaf.net!kate.ibmpcug.co.uk!rcp!alan
References: <3v7138$5kp@goanna.cs.rmit.edu.au> <3v68vs$hpb@ftcnews.nrcs.usda.gov> <3v8ahp$3u0@ftcnews.nrcs.usda.gov>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!kate.ibmpcug.co.uk!rcp!alan
From: alan@rcp.co.uk (Alan Stokes)
Newsgroups: comp.std.c
Subject: Re: vprintf confusion?
Message-ID: <KjQHwAuMBh107h@rcp.co.uk>
Date: Mon, 31 Jul 95 12:46:02 GMT
References: <3v7138$5kp@goanna.cs.rmit.edu.au> <3v68vs$hpb@ftcnews.nrcs.usda.gov> <3v8ahp$3u0@ftcnews.nrcs.usda.gov>
Organization: RCP Consultants Ltd.