* Common Porting Problem
@ 1996-11-28 20:38 Scott Locklin
0 siblings, 0 replies; 7+ messages in thread
From: Scott Locklin @ 1996-11-28 20:38 UTC (permalink / raw)
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.
Lots of people write code which assumes the same number of bytes in
pointers & integers; 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.
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?
Or am I doomed to wading through dozens of
"warning: cast to pointer from integer of different size"
messages?
-Scott
--
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Common Porting Problem
@ 1996-11-28 22:25 Earl Curley
0 siblings, 0 replies; 7+ messages in thread
From: Earl Curley @ 1996-11-28 22:25 UTC (permalink / raw)
unsubscribe
This list was subscribed to by a forged e-mail address
Earl Curley
psychic@globalserve.net
--
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Common Porting Problem
[not found] <Pine.LNX.3.91.961128142553.24232A-100000@lonsdale.lbl.gov>
@ 1996-11-28 23:33 ` Michal Jaegermann
1996-11-30 0:24 ` Jim Nance
1 sibling, 0 replies; 7+ messages in thread
From: Michal Jaegermann @ 1996-11-28 23:33 UTC (permalink / raw)
>
> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Common Porting Problem
[not found] <locklin@lonsdale.lbl.gov>
@ 1996-11-29 4:08 ` Bryan W. Headley
0 siblings, 0 replies; 7+ messages in thread
From: Bryan W. Headley @ 1996-11-29 4:08 UTC (permalink / raw)
On Nov 28, 2:38pm, Scott Locklin wrote:
> Subject: Common Porting Problem
> 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.
>
> Lots of people write code which assumes the same number of bytes in
> pointers & integers; 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.
>
> 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?
> Or am I doomed to wading through dozens of
> "warning: cast to pointer from integer of different size"
> messages?
>
That's right: you are doomed. Nice thing is, there are more and more 64-bit
machines out there, so code is becoming more clean.
Or you can typedef those ints into longs :-) Sort of like a C++ mantra my
friend has on his board:
typedef class struct;
typedef protected public;
typedef private public;
--
Bryan W. Headley Home: bheadley@interaccess.com
211 East Pineview Drive Office: bwh@abnamro.com
Round Lake Park, IL 60073 Phone: 847 740-1446
--
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Common Porting Problem
[not found] <9611282208.ZM1182@davros.bwh.com>
@ 1996-11-29 5:34 ` Michal Jaegermann
0 siblings, 0 replies; 7+ messages in thread
From: Michal Jaegermann @ 1996-11-29 5:34 UTC (permalink / raw)
>
> > Or am I doomed to wading through dozens of
> > "warning: cast to pointer from integer of different size"
> > messages?
> >
...
>
> Or you can typedef those ints into longs :-)
Particularly nice if you pass them later to a function (especially
from a library :-) which expects ints for arguments. Don't forget
to set a high limit for core sizes before you will do that.
Excellent for learning dark corners of gdb. :-)
--mj
--
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Common Porting Problem
@ 1996-11-29 9:33 David A Rusling
0 siblings, 0 replies; 7+ messages in thread
From: David A Rusling @ 1996-11-29 9:33 UTC (permalink / raw)
I know that this doesn't help but the Alpha OSF compiler has a handy -tasm switch
that does exactly this and is very useful when you don't actually want to play with
brain damaged code...
Dave
----------------------------------------------------------------------
David A Rusling Principal Engineer
European Semiconductor Applications Digital Equipment Co Ltd.,
Engineering PO Box 121,
Imperial Way,
Worton Grange
Reading RG2 0TU
Linux, Alpha, StrongArm, PCI Tel: UK-(0)1734-204380
Fax: UK-(0)1734-203133
----------------------------------------------------------------------
--
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Common Porting Problem
[not found] <Pine.LNX.3.91.961128142553.24232A-100000@lonsdale.lbl.gov>
1996-11-28 23:33 ` Michal Jaegermann
@ 1996-11-30 0:24 ` Jim Nance
1 sibling, 0 replies; 7+ messages in thread
From: Jim Nance @ 1996-11-30 0:24 UTC (permalink / raw)
> 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.
I see you have been.
> 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?
The Digital Unix compiler has a switch (-taso) which tries to do this.
What it does is link everything in the lower 2G of address space so that
if something tries to stuff a pointer into an integer the pointer will
fit. Gcc does not have this option, but you may be able to use the
-Tbss -Tdata and -Ttext flags to achieve the same effect. These flags
allow you to set the location of the bss, data, and text sections of
the executables. Unfortunatly I have no idea where you should locate
them :-(. You may also have to hack up malloc() and friends to ensure
that you only get memory in the lower 31 bits of address space.
Hope this helps.
Jim
--
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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~1996-11-30 0:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <locklin@lonsdale.lbl.gov>
1996-11-29 4:08 ` Common Porting Problem Bryan W. Headley
[not found] <Pine.LNX.3.91.961128142553.24232A-100000@lonsdale.lbl.gov>
1996-11-28 23:33 ` Michal Jaegermann
1996-11-30 0:24 ` Jim Nance
1996-11-29 9:33 David A Rusling
[not found] <9611282208.ZM1182@davros.bwh.com>
1996-11-29 5:34 ` Michal Jaegermann
-- strict thread matches above, loose matches on Subject: below --
1996-11-28 22:25 Earl Curley
1996-11-28 20:38 Scott Locklin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox