By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,179 Members | 2,175 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,179 IT Pros & Developers. It's quick & easy.

flexible array member

P: n/a
Can someone help me understand what flexible array members exactly are,
how they behave and how could them be implemented by a i386?
Also I didn't understand the two exceptions that the standards talks
about (when talking about ignoring the flexible array member). Please
help me.

--
Devaraja (Xdevaraja87^gmail^c0mX)
Linux Registerd User #338167
http://counter.li.org
Nov 15 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

DevarajA 写道:
Can someone help me understand what flexible array members exactly are,
how they behave and how could them be implemented by a i386?
Also I didn't understand the two exceptions that the standards talks
about (when talking about ignoring the flexible array member). Please
help me.

--
Devaraja (Xdevaraja87^gmail^c0mX)
Linux Registerd User #338167
http://counter.li.org


They allow for the last member of a struct to be an incomplete type
until an oject
of such a type is allocated. As such, there is a lack of information to
determine
the size of the struct. This means that when you allocate an object
that will
represent this struct type, you can provide the information about the
size that
the struct object needs to be. Take for example a message queue system,
where
the size of the message has not yet been determined. Where you choose
to not
place constraints on a message size, you could use a flexible array
member to
represent this undetermined size.

i386 is conceptually irrelevant to the implementation of flexible array
members.
This is because an implementation that adheres to the 9899:1999
specification
is fundamentally a virtual machine. It need not care about the
underlying hardware.

As for the two exceptions, care to provide a section number from the
standard?

--
aegis

Nov 15 '05 #2

P: n/a
aegis ha scritto:
DevarajA 写道:

Can someone help me understand what flexible array members exactly are,
how they behave and how could them be implemented by a i386?
Also I didn't understand the two exceptions that the standards talks
about (when talking about ignoring the flexible array member). Please
help me.

--
Devaraja (Xdevaraja87^gmail^c0mX)
Linux Registerd User #338167
http://counter.li.org

They allow for the last member of a struct to be an incomplete type
until an oject
of such a type is allocated.


Ok, thanks.

[cut] As for the two exceptions, care to provide a section number from the
standard?


6.7.2.16 (it should be page 103, but I'm not sure because I've got it on
pdf)

--
Devaraja (Xdevaraja87^gmail^c0mX)
Linux Registerd User #338167
http://counter.li.org
Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.