cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/16/22:03:25

From: ryot AT bigfoot DOT com (George Ryot)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: From Bytes to Int and Char
Message-ID: <37bd890c.14677884@news.clara.net>
References: <rfXs3.4$bZ1 DOT 1603 AT typhoon01 DOT swbell DOT net> <37B466D7 DOT 958F09E5 AT americasm01 DOT nt DOT com> <37B4DFD1 DOT 4D66 AT surfsouth DOT com> <37B57EB0 DOT 492A93AE AT unb DOT ca> <37ba82f5 DOT 7514501 AT news DOT clara DOT net> <37B82AAA DOT E7223AB1 AT americasm01 DOT nt DOT com>
X-Newsreader: Forte Agent 1.5/32.452
X-No-Archive: yes
MIME-Version: 1.0
Lines: 20
Date: Mon, 16 Aug 1999 22:19:23 GMT
NNTP-Posting-Host: 195.8.92.47
X-Complaints-To: abuse AT clara DOT net
X-Trace: nnrp4.clara.net 934841963 195.8.92.47 (Mon, 16 Aug 1999 23:19:23 BST)
NNTP-Posting-Date: Mon, 16 Aug 1999 23:19:23 BST
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Campbell, Rolf [SKY:1U32:EXCH]" <cp1v45 AT americasm01 DOT nt DOT com> wrote:

>     I don't understand how your code is any less of a 'hack' than mine.  Both are not
> endian safe.  Both will work consistantly on each individual machine (I'm not saying
> that you could exchange data files and have them work).  How is my code 'unsafe'?

Casting between pointers to different types is nearly always unsafe.

The code I posted will solve the original problem (as I understand it)
and will work the same on *all* implementations except attention is
required to unsigned values.

The original post has now been answered and this has little to do with
DJGPP.

Nick, if you still have problems feel free to email me.  Better still,
try a more appropriate forum such as alt.comp.lang.learn.c-c++ or
comp.lang.c where many C/C++ gurus are waiting to help you.
-- 
george

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019