🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4839

Re: sizeof(char) ~= sizeof(float)

#4839
From: Tanmoy Bhattacharya
Date: Tue, 27 Feb 1996 18:42
36 lines
2507 bytes
In article <DnFr78.1wo@ukpsshp1.serigate.philips.nl>
baynes@ukpsshp1.serigate.philips.nl (Stephen Baynes) writes:

SB: Tanmoy Bhattacharya (tanmoy@qcd.lanl.gov) wrote:
SB: : In article <4gr3d1$dca@usenet.pa.dec.com>
SB: : diamond@tbj.dec.com (Norman Diamond) writes:
SB: <snip - copying data by using chars of different sorts vs memcpy >
SB: : This was a free-standing implementation, and memcpy may be absent. (In
SB: : a hosted implementation, as all read/write is done as if through
SB: : getc/putc which handles unsigned char values, and binary files written
SB: : out must be read back unchanged, the situation is impossible).
SB: 
SB: That read/write is done by getc/putc does not imply very much about copying
SB: chars. I don't see any requirement that fwrite/fread use one putc/getc per
SB: byte(ie char) of memory. Fwrite could use one per bit writing the
values 'Y' or 
SB: 'N' if it wanted so long as fread will read it back again. My
understanding 
SB: is that the use of getc/putc means you can write a file with
fwrite, copy it 
SB: with getc/putc and read the copy with fread to get what you started with.

I understood it to mean that I could take the same (void*) pointer to
the data, and call putc repeatedly on the successive bytes of the
data, and the resulting file is identical to doing an fwrite. I think
the standard should clarify its meaning.

Cheers
Tanmoy
--
tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
<http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
Technical Details
Message-ID: <TANMOY.96Feb27114201@qcd.lanl.gov>
Path: arc1-ca.pugleaf.net!newshost.lanl.gov!tanmoy
References: <WALD.96Feb24131532@woodpecker.lcs.mit.edu> <4gr3d1$dca@usenet.pa.dec.com> <TANMOY.96Feb25203514@qcd.lanl.gov> <DnFr78.1wo@ukpsshp1.serigate.philips.nl>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!newshost.lanl.gov!tanmoy
From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
Newsgroups: comp.std.c
Subject: Re: sizeof(char) ~= sizeof(float)
Date: 27 Feb 1996 18:42:01 GMT
Organization: Los Alamos National Laboratory
Message-ID: <TANMOY.96Feb27114201@qcd.lanl.gov>
References: <WALD.96Feb24131532@woodpecker.lcs.mit.edu> <4gr3d1$dca@usenet.pa.dec.com>
 <TANMOY.96Feb25203514@qcd.lanl.gov>
 <DnFr78.1wo@ukpsshp1.serigate.philips.nl>
NNTP-Posting-Host: qcd.lanl.gov
Mime-Version: 1.0
Content-Type: text
In-reply-to: baynes@ukpsshp1.serigate.philips.nl's message of Tue, 27 Feb 1996 13:09:08 GMT