Re: return?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 05, 2003 at 17:32:43 -0500, Mark Hounschell wrote:
> Is it possible to have a function return a 64 bit variable using
> 
> 	return 64bitvarname

I am not sure this is the right list. However:

Variable of ANY VALID TYPE can be returned. With special care to arrays
(they are used as pointer and thus returned as pointers). That namely
includes all primitive types (char, int, float, double) with any
modifiers (short, long, long long, signed, unsigned), pointers to any
types, enum types, struct types and union types.

So yes, you can return 64 bit value.

Note however, that returning large things is usualy inefficient, because
they are pushed on stack and then poped in the calling function -- that
is copied in memory twice. On i386, up to 64 bits should be passed in
registers (EDX:EAX pair) and so shouldn't suffer this inefficiency, but
I have not checked. Also note, that GCC is known to generate poor code
when working with long longs.

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@ucw.cz>
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux