🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c.moderated
Article #2301

Re: Pointer Arithmetic

#2301
From: Henning Makholm
Date: Sat, 16 Mar 1996 14:51
21 lines
1307 bytes
schweikh@itosun.ito.uni-stuttgart.de (Jens Schweikhardt) writes:

>- the sizeof int, which might well be 3, 5, or 42.

It's allowed to be, but Real machines hardly use word lengths that are
not either powers of two or quite small (i.e. not exceeding, say, 3
chars), do they?

>- What the instruction set of the machine supports.
>  There may be machines that have instructions to compute
>  base+(index * somesize) [I bet there are!]

i386 and followers have these addressing modes available when running
32-bit and somesize is (I think) either 2, 4 or 8. I'm not sure
whether they're to be preferred over explicit shifts and additions on
later members of the family...

-- 

Henning Makholm - math and CS student - University of Copenhagen
makholm@diku.dk - http://www.diku.dk/students/makholm - fido 2:235/224.92
Technical Details
Message-ID: <4iekgo$9q6@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4i805f$47d@solutions.solon.com> <4i97kl$8i5@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: makholm@diku.dk (Henning Makholm)
Newsgroups: comp.lang.c.moderated
Subject: Re: Pointer Arithmetic
Date: 16 Mar 1996 08:51:04 -0600
Organization: Department of Computer Science, U of Copenhagen
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4iekgo$9q6@solutions.solon.com>
References: <4i805f$47d@solutions.solon.com> <4i97kl$8i5@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com