delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/29/09:32:22

From: nikki AT kki DOT net DOT pl (Inquisitor Nikodemus)
Newsgroups: comp.os.msdos.djgpp
Subject: GCC and pointers : QUESTION
Date: Wed, 29 Jul 1998 13:13:37 GMT
Organization: http://news.icm.edu.pl/
Lines: 14
Message-ID: <35bf1ff4.1246159@news.icm.edu.pl>
NNTP-Posting-Host: pppa162.poznan.tpnet.pl
Mime-Version: 1.0
NNTP-Posting-Date: 29 Jul 1998 13:16:07 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hey!


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 ?


/greetz
Nikki 

- Raw text -


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