From: Michal Jaegermann <michal@ellpspace.math.ualberta.ca>
Subject: Re: Common Porting Problem
Date: Thu, 28 Nov 1996 16:33:04 -0700 (MST) [thread overview]
Message-ID: <164a01bb049532129d3292c1e5543269.axp-list@archive.invalid> (raw)
In-Reply-To: <Pine.LNX.3.91.961128142553.24232A-100000@lonsdale.lbl.gov>
>
> I know I'm going to be raked over the coals for asking this, as it's
> probably been rehashed any number of times; here it goes anyway.
If you would have Atari or Amiga you would have run into this problem
a number of years ago. :-)
> Lots of people write code which assumes the same number of bytes in
> pointers & integers;
That is correct. They also assume that longs are four bytes wide and
that "all the world is VAX". It is also correct that such code is simply
broken as written. There is also quite a few programs around written by
people who do not subscribe "it happens to work on my machine, therefore
is right" school of programming.
> when I try to compile such code it complains
> something like
> "warning: cast to pointer from integer of different size"
> And when I try to run , it dumps core, like it's supposed to.
Such "warnings" point, nearly always, to a deadly problem and the code
needs to be fixed.
> My question; is there a compiler switch I can use to make the pointers 4
> bytes or the integers 8, so this stuff will work without major surgery?
As 32-bit version of Linux for AXP vanished in early stages, so I am
afraid that you just need to fix sloppy practices of others. Carefuly
including all required headers and adding prototypes very often goes
a looong way towards working program. gcc has actually a switch which
makes missing prototypes into an error. It is a good idea to use it in
a porting work.
> Or am I doomed to wading through dozens of
> "warning: cast to pointer from integer of different size"
> messages?
Wading through messages does not help. You have to make them
disappear. You should be happy that your compiler helps you to spot
bad code. It is much harder to that from a debugger. :-)
Michal
--
To unsubscribe: send e-mail to axp-list-request@redhat.com with
'unsubscribe' as the subject. Do not send it to axp-list@redhat.com
next parent reply other threads:[~1996-11-28 23:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.LNX.3.91.961128142553.24232A-100000@lonsdale.lbl.gov>
1996-11-28 23:33 ` Michal Jaegermann [this message]
1996-11-30 0:24 ` Common Porting Problem Jim Nance
1996-11-29 9:33 David A Rusling
[not found] <9611282208.ZM1182@davros.bwh.com>
1996-11-29 5:34 ` Michal Jaegermann
[not found] <locklin@lonsdale.lbl.gov>
1996-11-29 4:08 ` Bryan W. Headley
-- strict thread matches above, loose matches on Subject: below --
1996-11-28 22:25 Earl Curley
1996-11-28 20:38 Scott Locklin
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox