473,385 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

flexible array member

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
2 2966

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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Kaz Kylheku | last post by:
Given some class C with array T x, is it possible to get a pointer-to-data-member to one of the elements? &C::x gives us a pointer-to-member-array: T (C::*). But I just want to get a T C::*...
10
by: Adam Warner | last post by:
Hi all, With this structure that records the length of an array of pointers as its first member: struct array { ptrdiff_t length; void *ptr; };
2
by: Simon Morgan | last post by:
I hope this isn't OT, I looked for a newsgroup dealing purely with algorithms but none were to be found and seeing as I'm trying to implement this in C I thought this would be the best place. I...
2
by: Christopher Benson-Manica | last post by:
Is the following program conforming under C99? #include <stdio.h> typedef struct foo { int bar; int baz; } foo; foo foos={
5
by: Varangian | last post by:
ImageButton ship; ship = new ImageButton; for (int i=0; i<5; i++) { ship.ImageUrl = pathofImage; ship.ID = "ShipNo" + i.ToString(); ship.Click += new...
8
by: ulyses | last post by:
I'm trying to put pointer to flexible array of structures in other structure. I want to have pointer to array of pixels in screen structure. Here is mine code, but I think it isn't quite all right:...
20
by: mechanicfem | last post by:
I thought (as they're in c99) that flexible arrays were there for a number of reasons - but I also thought they'd be great for stepping into structures (say) that were aligned in memory after (say)...
2
by: tobiasoed | last post by:
Hello, I want to do something similar to this: #include <stdlib.h> struct coord { double val; double err; };
3
by: Hallvard B Furuseth | last post by:
to find the required alignment of a struct, I've used #include <stddef.h> struct Align_helper { char dummy; struct S align; }; enum { S_alignment = offsetof(struct Align_helper, align) };
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.