🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #2156

Re: Pointers vs. arrays

#2156
From: Jim Giles
Date: Sun, 18 Nov 1990 02:03
27 lines
1285 bytes
From article <2742@l.cc.purdue.edu>, by cik@l.cc.purdue.edu (Herman Rubin):
> [...]
> 	*y++ = *x++;
>         decrease x, treated as a byte pointer, by 1;

Ok.  I see now.  I interpreted your initial request differently.
The equivalent non-pointer version is (including the declarations
you left out):

      bit.32 :: y(Number_of_elements)
      bit.24 :: x(Number_of_elements)
      ...
      do i=1,Number_of_elements
	 y(i) = x(i)
      end do

> [...]
> This uses one unaligned read and one aligned write, as compared to
> three reads and writes.

So does my version.  At least, assuming that 32-bit numbers are
aligned.  (Note: 'bit' data types are unsigned; for signed integers,
the declaration is 'int'.  Your use of pointers is thus seen as
an example of needing to get around restrictions caused by inadequate
control over data types.)

J. Giles
Technical Details
Message-ID: <6291@lanl.gov>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!att!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!rpi!uupsi!cmcl2!lanl!jlg
References: <2742@l.cc.purdue.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!att!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!rpi!uupsi!cmcl2!lanl!jlg
From: jlg@lanl.gov (Jim Giles)
Newsgroups: comp.lang.misc
Subject: Re: Pointers vs. arrays
Message-ID: <6291@lanl.gov>
Date: 18 Nov 90 02:03:48 GMT
References: <2742@l.cc.purdue.edu>
Organization: Los Alamos Natl Lab, Los Alamos, N.M.
Lines: 27