cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/07/18:31:45

From: myknees AT aol DOT com (Myknees)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: GCC and pointers : QUESTION
Lines: 17
Message-ID: <1998080722171300.SAA10608@ladder01.news.aol.com>
NNTP-Posting-Host: ladder01.news.aol.com
Date: 07 Aug 1998 22:17:13 GMT
References: <Pine DOT SOL DOT 3 DOT 96 DOT 980805225348 DOT 734A-100000 AT sol DOT sun DOT csd DOT unb DOT ca>
Organization: AOL http://www.aol.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

In article <Pine DOT SOL DOT 3 DOT 96 DOT 980805225348 DOT 734A-100000 AT sol DOT sun DOT csd DOT unb DOT ca>,
Endlisnis <s257m AT unb DOT ca> writes:

>On Wed, 29 Jul 1998, Inquisitor Nikodemus wrote:
>->During writing a function I noticed that operations - such as addition
>->or substraction - on pointers of different types than char didn't
>->behave as I expected them to. Eg. adding 2 to the the pointer  :
>->  short    *pointer_to_short  ;
>->resulted in 4 byte offset,not 2 byte. Same for ints etc.
>->So the question is : is it really a fact,that gcc's pointer math
>->depends on type rather than raw bytes ?
>	That's how it is in all ANSI C++ compilers.

Even pre-ANSI.  I read the original Kernighan & Ritchie book, and they said
that that is just how the C language works.  It's a feature of the language.

--Ed (Myknees)

- Raw text -


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