Sign in

username:

password:



Not a member?

Search motoroladsp



Search tips

Subscribe to motoroladsp



motoroladsp by Keywords

56303 | 563xx | 5680 | 56805 | 5680x | 56F80 | 56F800DEMO | 56F805 | 56f807 | 56F830 | ADC | Bootloader | Codec | CodeWarrior | CW5 | CW6 | Debugger | DSP56303 | DSP56303EVM | DSP563xx | DSP5680 | DSP56800 | DSP56807 | DSP56858 | DSP56858EVM | DSP56F803 | DSP56F805 | DSP56F807 | DSP56F80x | DSP56F826 | DSP56F827 | DSP56F8xx | EVM | FFT | Flash_over_jtag | GPIO | Interrupt | Interrupts | JTAG | LCD | Linker | MCF5307 | Metrowerks | Modulus | MSCAN | PCMaster | PWM | Quad | Rif | RTOS | SDK | SPI

Discussion Groups

Discussion Groups | Freescale DSPs | does compiler pass structs as pointer, or by value?

Technical discussions about Freescale (Motorola) DSPs (including the DSP56000, DSP56300, DSP56600, 56800 DSPs).

  

Post a new Thread

does compiler pass structs as pointer, or by value? - Corey, Rick - Aug 28 19:35:00 2003



Hi

Does anyone happen to know whether the C compiler for 5680x (either version
5.0.4 or 5.1) passes structs as pointers, or by value?

I mean, does it put every byte of the struct onto the stack, or just pass a
reference?

For instance, would this invocation put one word on the stack for a pointer,
or around 55 words of data?

(I don't want to add stack check routines because I'm running out of RAM,
afraid I'll overflow the stack for real, and I'm hoping someone kind already
knows the answer. Other compilers pass a pointer even if you try to pass
the whole struct; who knows what Metrowerks does?)

typedef struct theCanMsgStruc {
UWord16 CmdSeqNum;
UWord16 ImuNumber;
UWord16 CanPriority;
UWord16 CmdCode;
UWord16 MessageLen;
UWord16 MsgDataByte[50];
} DummyVar3; struct theCanMsgStruc CanMsgStruct ; // variable declaration

unsigned short SendCanMsg( struct theCanMsgStruc sMsgToSend ); //
function prototype

SendCanMsg( CanMsgStruct ); // invocation of function: note NOT
&CanMsgStruct

Thanks in advance.

Rick Corey
Senior Software Engineer
DPC Instrument Systems Division





(You need to be a member of motoroladsp -- send a blank email to motoroladsp-subscribe@yahoogroups.com )

RE: does compiler pass structs as pointer, or by value? - Brauchli Netsolution Berg - Aug 28 20:24:00 2003

Hi Rick,
just run the di-assembly function of the Codewarrier IDE, and check the
SendCanMsg() then you know it in 1 minute how the codewarrier is doing this
special pass of a struct.

rgds Chris
>-- Original-Nachricht --
>To: "'" <>
>From: "Corey, Rick" <>
>Date: Thu, 28 Aug 2003 12:35:02 -0700
>Subject: [motoroladsp] does compiler pass structs as pointer, or by value? >Hi

Does anyone happen to know whether the C compiler for 5680x (either version
5.0.4 or 5.1) passes structs as pointers, or by value?

I mean, does it put every byte of the struct onto the stack, or just pass
a
reference?

For instance, wou
>d this invocation put one word on the stack for a pointer,
or around 55 words of data?

(I don't want to add stack check routines because I'm running out of RAM,
afraid I'll overflow the stack for real, and I'm hoping someone kind already
knows th
> answer. Other compilers pass a pointer even if you try to pass
the whole struct; who knows what Metrowerks does?)

typedef struct theCanMsgStruc {
UWord16 CmdSeqNum;
UWord16 ImuNumber;
UWord16 CanPriority;
UWord16 CmdCode;

>Word16 MessageLen;
UWord16 MsgDataByte[50];
} DummyVar3; struct theCanMsgStruc CanMsgStruct ; // variable declaration

unsigned short SendCanMsg( struct theCanMsgStruc sMsgToSend ); //
function prot
>type

SendCanMsg( CanMsgStruct ); // invocation of function: note NOT
&CanMsgStruct

Thanks in advance.

Rick Corey
Senior Software Engineer
DPC Instrument Systems Division ------------------------ Yahoo! Groups Sponsor ----------------
>----~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/PNArlB/
>M
---------------------------------------------------------------------~->

_____________________________________
/groups.php3 ______________________________________
BRAUCHLI NETSOLUTION BERG
BAHNHOFSTASSE 7,
CH-8572 BERG
SWITZERLAND
TEL +41/71/6380045
FAX +41/71/6380046
MOBILE +41/78/6162214
EMAIL
WEB www.brauchli-netsolution.ch
______________________________________




(You need to be a member of motoroladsp -- send a blank email to motoroladsp-subscribe@yahoogroups.com )