Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
* help, malloc 32 vs malloc 64
@ 1994-10-15 13:33 Teak 'Teakster' Min
  1994-10-15 19:56 ` Rich Salz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Teak 'Teakster' Min @ 1994-10-15 13:33 UTC (permalink / raw)



If anyone has any information or possible solution to this question, I would 
be very appreciative. 

Problem:  I am working on a DEC Alpha using OSF/1.  I need to know
if there is anyway to #define an int in C to a long.  What I am 
having problems is that when I malloc and I get a memory location, 
the address is assigned to a pointer of type int which is 32bit but
the system gives back an address with is greater than 32bit address.
I know that OSF is a 64 bit architecture.  What I need to know is
how to compile my program which will use only address in the
32bit range OR set on option that will make int larger than 32bit.
This program (or I should say environment) is compiled using both
cc and gcc.  I was TOLD that c was a portable code, was I lied to?
Why not change all my int to long? Well this program has over a
hundred if not more files in several directories and I wish not
to go in all those files and change int to long.  Unfortunately all
my addresses get truncated when they are passes around so I get
all kinds of problems.            

I thank all those who took the time to read this message.  Thanks.


_/_/_/_/_/ _/_/_/     _/     _/   _/       Teak Min
   _/     _/        _/_/    _/  _/   Virginia Tech (VPI&SU) 
  _/     _/_/_/   _/  _/   _/_/          (703) 953-3998
 _/     _/      _/_/_/_/  _/  _/     teak@csugrad.cs.vt.edu 
_/     _/_/_/ _/      _/ _/    _/    teak@cray-ymp.acm.stuorg.vt.edu 
2713 Newton Court                    http://csugrad.cs.vt.edu/~teak/ 
Blacksburg, VA. 24060     	     #include<std.disclaimer>




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: help, malloc 32 vs malloc 64
  1994-10-15 13:33 help, malloc 32 vs malloc 64 Teak 'Teakster' Min
@ 1994-10-15 19:56 ` Rich Salz
  1994-10-19  3:37 ` David Boyce
  1994-10-21 13:36 ` Alan Herrlich
  2 siblings, 0 replies; 4+ messages in thread
From: Rich Salz @ 1994-10-15 19:56 UTC (permalink / raw)


In <37olne$rqn@csugrad.cs.vt.edu> teak@csugrad.cs.vt.edu (Teak 'Teakster' Min) writes:
>  I was TOLD that c was a portable code, was I lied to?

No you were not lied to.  The programmer who wrote the original code who
did things like
	int i = malloc(...)
was incompetent.

Good luck.
	/r$


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: help, malloc 32 vs malloc 64
  1994-10-15 13:33 help, malloc 32 vs malloc 64 Teak 'Teakster' Min
  1994-10-15 19:56 ` Rich Salz
@ 1994-10-19  3:37 ` David Boyce
  1994-10-21 13:36 ` Alan Herrlich
  2 siblings, 0 replies; 4+ messages in thread
From: David Boyce @ 1994-10-19  3:37 UTC (permalink / raw)


In article <37olne$rqn@csugrad.cs.vt.edu> teak@csugrad.cs.vt.edu (Teak 'Teakster' Min) writes:

> Problem:  I am working on a DEC Alpha using OSF/1.  I need to know
> if there is anyway to #define an int in C to a long.  What I am 
> having problems is that when I malloc and I get a memory location, 
> the address is assigned to a pointer of type int which is 32bit but
> the system gives back an address with is greater than 32bit address.
> I know that OSF is a 64 bit architecture.  What I need to know is
> how to compile my program which will use only address in the
> 32bit range OR set on option that will make int larger than 32bit.
> This program (or I should say environment) is compiled using both
> cc and gcc.

Perhaps I'm missing something, but this sounds exactly like what the
-taso (truncated address space option) flag on DEC's C compiler is
designed for.  Have you looked that up in the man page?
-- 

David Boyce	(dsb@id.wing.net)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: help, malloc 32 vs malloc 64
  1994-10-15 13:33 help, malloc 32 vs malloc 64 Teak 'Teakster' Min
  1994-10-15 19:56 ` Rich Salz
  1994-10-19  3:37 ` David Boyce
@ 1994-10-21 13:36 ` Alan Herrlich
  2 siblings, 0 replies; 4+ messages in thread
From: Alan Herrlich @ 1994-10-21 13:36 UTC (permalink / raw)


In article <37olne$rqn@csugrad.cs.vt.edu> teak@csugrad.cs.vt.edu (Teak 'Teakster' Min) writes:

>   Problem:  I am working on a DEC Alpha using OSF/1.  I need to know
>   if there is anyway to #define an int in C to a long.  What I am 
>   having problems is that when I malloc and I get a memory location, 
>   the address is assigned to a pointer of type int which is 32bit but
>   the system gives back an address with is greater than 32bit address.

>   cc and gcc.  I was TOLD that c was a portable code, was I lied to?

The short answer is to use the -taso switch on the OSF/1 C compiler.
That will cause the C compiler to tell the linker to create a program
that will only have 32 bit addresses.

For the long answer I suggest that you ask about C portablility issues
in a C related newsgroup. There are lots of assumptions that you can
make in a C program that can make if non-portable.


--
Alan Herrlich					herrlich@microw.enet.dec.com

Opinions herein are my own and do not necessarily reflect those of Digital.
For a summary of Digital's Internet services, send mail to info@digital.com


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1994-10-21 13:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-10-15 13:33 help, malloc 32 vs malloc 64 Teak 'Teakster' Min
1994-10-15 19:56 ` Rich Salz
1994-10-19  3:37 ` David Boyce
1994-10-21 13:36 ` Alan Herrlich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox