🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3192

Re: call to revolt

#3192
From: J. Horsmeier
Date: Wed, 26 Jun 1991 08:39
50 lines
2569 bytes
In article <rabson.677868220@physics.ubc.ca> rabson@physics.ubc.ca (David Rabson) writes:
[...]
>Outlawing lvalue casts, however, borders on fascism.  I have yet to see
>a pre-ansi compiler that fails to treat properly
>
>		void *thing;
>		((int *)thing)++;
>
>(or, if it doesn't know about voids, the same thing with char *thing).  I
>realize that some machines might, in principle, have different alignments for
>different types of pointers.   A void *, however, I thought, was guaranteed
>to obey the most restrictive alignment and hence be castable to any other
>pointer.
>
>I hereby invite the black-shirts from the ansi camp to explain their
>prejudice against casting lvalues.
[...]
>David Rabson
>Departments of Physics, University of British Columbia and McMaster University

Hi there, I'll die if casting lvals is going to be illegal. Currently I'm
fiddling and hacking my way into a FORTRAN (Yuck) program, trying to interface
the beast with loads of old C code. One of my most frequent statements is:

type* Thing;

((int)Thing)= Thing-Base+1;

where Thing points into an array of things and Base is the beginning of the
array, just to change pointers into FORTRAN indices. 
I know this is dirty and things might go into la la land on lots of 
machines, but it works on the machine it's running on now. 
I also know that I can overlay different types with unions. 

But why? Things used to work fine this way (if you know what you're doing). 
I really like the statement: `You get what you deserve'. Here I get what I
want :-) BTW beauty doesn't count when FORTRAN is involved. 

You have my support on this topic!

Jos


+----------------------------------------------------------------------+
|O   J.A. Horsmeier AND Software B.V.        phone : +31 10 4367100   O|
|O                  Westersingel 106/108     fax   : +31 10 4367110   O|
|O                  3015 LD  Rotterdam NL    e-mail: jos@and.nl       O|
|O--------------------------------------------------------------------O|
|O               I am a Hamburger (F. Zappa 1974)                     O|
+----------------------------------------------------------------------+
Technical Details
Message-ID: <992@baby.and.nl>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!uunet!mcsun!hp4nl!and!jos
References: <rabson.677868220@physics.ubc.ca>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!uunet!mcsun!hp4nl!and!jos
From: jos@and.nl (J. Horsmeier)
Newsgroups: comp.std.c
Subject: Re: call to revolt
Message-ID: <992@baby.and.nl>
Date: 26 Jun 91 08:39:33 GMT
References: <rabson.677868220@physics.ubc.ca>
Organization: AND Software BV Rotterdam
Lines: 50