From RTSC-Pedia

Jump to: navigation, search
revision tip
—— LANDSCAPE orientation
[printable version]  [offline version]offline version generated on 04-Aug-2010 21:08 UTC

XDCscript - Struct-Object.$sizeof

The target size of a structure


Contents

Synopsis

 
«tobj».$sizeof()

Description

Returns the target size of the structure «tobj» in target chars. In other words, this function returns the same value that the target compiler would provide when applying the C sizeof() operator on the structure. Note this may be different from the number of 8-bit bytes in the structure; some target architectures have a 16-bit char.

Example

The following example illustrates the use of the $sizeof() method. The size of the structure declared in Mod.xdc is printed from an application configuration script app.cfg.

Mod.xdc
 
 
 
 
 
 
module Mod { 
    struct S = {
        Int x;
        Char c;
    }
}
app.cfg
 
 
var Mod = xdc.useModule("Mod");
print("sizeof Mod.S = " + Mod.S.$sizeof());

See also

XDCscript - Struct-Object.$alignof The target alignment of a structure
XDCscript - Typed-Object Objects specified by the RTSC Interface Definition Language
[printable version]  [offline version]offline version generated on 04-Aug-2010 21:08 UTC
Copyright © 2008 The Eclipse Foundation. All Rights Reserved


Views
Personal tools
package reference