473,387 Members | 1,535 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,387 software developers and data experts.

How come C allow structure members to be addressed like an array ?

#include <stdio.h>

typedef struct
{
double x, y, z;
}vector;

int main(void)
{
int i;
vector v;
double *cord;

v.x = 10;
v.y = 1;
v.z = 2;

cord = &v.x;

for(i = 0; i < 3; i++)
{
printf("%f\n", cord[i]);
}
return 0;
}

here's the output i get:
10.000000
1.000000
2.000000

which is the same as v

i don't how it happens as i was just trying some random ideas but
great stuff really. helped me to reduce some of my code to almost
1/3rd its size.
Jun 27 '08 #1
85 2310
On Jun 14, 5:37*pm, pereges <Brol...@gmail.comwrote:
#include <stdio.h>

typedef struct
{
* double x, y, z;

}vector;

int main(void)
{
* int i;
* vector v;
* double *cord;

* v.x = 10;
* v.y = 1;
* v.z = 2;

*cord = &v.x;

*for(i = 0; i < 3; i++)
*{
* printf("%f\n", cord[i]);
*}
return 0;

}

here's the output i get:
10.000000
1.000000
2.000000

which is the same as v

i don't how it happens as i was just trying some random ideas but
great stuff really. helped me to reduce some of my code to almost
1/3rd its size.
This is not portable but at the low level there is no difference
between a structure containing three doubles and an array of three
doubles in this case.

You cannot assume this, as some implementation might introduce pads
for byte alignment in structures.

The following articles should help:

http://www.eventhelix.com/RealTimeMa...ranslation.htm
http://www.eventhelix.com/RealTimeMa...anslation2.htm
http://www.eventhelix.com/RealTimeMa...anslation3.htm

--
EventStudio 4.0 - http://www.Eventhelix.com/Eventstudio/
Sequence diagram based systems engineering tool
Jun 27 '08 #2
In article <a0**********************************@34g2000hsf.g ooglegroups.com>,
EventHelix.com <ev********@gmail.comwrote:
>This is not portable but at the low level there is no difference
between a structure containing three doubles and an array of three
doubles in this case.
Fields in a struct are aligned in "an implementation-defined manner
appropriate to [their] type". The clear implication is that the
padding is a property of the type (rather than each individual
instance) and so it would be unreasonable for the padding of
successive members of the same type in a struct to be different from
that in an array - which is to say, there should be no padding between
fields of the same type.

Can anyone come up with a reason (other than perverseness) why an
implementation would not do this?

-- Richard
--
In the selection of the two characters immediately succeeding the numeral 9,
consideration shall be given to their replacement by the graphics 10 and 11 to
facilitate the adoption of the code in the sterling monetary area. (X3.4-1963)
Jun 27 '08 #3
one can solve this problem using a vector iterator function like below
but i am not sure if the solution is generic :

#include <stdio.h>

typedef struct
{
double x, y, z;

}vector;

double vector_iterator(vector *a, int i)
{
double ret;
if(i == 0)
ret = a->x;
if(i == 1)
ret = a->y;
if(i == 2)
ret = a->z;
return ret;
}

int main(void)
{
int i;
vector v;
double coord;

v.x = 10;
v.y = 1;
v.z = 2;

for(i = 0; i < 3; i++)
{
coord = vector_iterator(&v, i);
printf("%f\n", coord);
}
return 0;

}

Jun 27 '08 #4

Others have explained the padding situation, but if you want re-
assurance, you might add a routine to the start of your code that
makes sure it's OK:

void EnsureItWorks(void)
{
Vector const v = { 99, 56, 42 };

if (99 == (&v.x)[0] &&
56 == (&v.x)[1] &&
42 == (&v.x)[2]) return;

puts("ERROR: There's padding in the Vector struct.");

exit(EXIT_FAILURE);
}

int main(void) { EnsureItWorks(); }
(I know that floating-point arithmetic isn't exact but as far as I
know it's exact for integer values... but I'm open to correction!)
Jun 27 '08 #5
Tomás Ó hÉilidhe wrote:
void EnsureItWorks(void)
{
Vector const v = { 99, 56, 42 };

if (99 == (&v.x)[0] &&
56 == (&v.x)[1] &&
42 == (&v.x)[2]) return;
*BANG*
(&v.x)[1] or (&v.x)[2] is a trap representation :)
puts("ERROR: There's padding in the Vector struct.");

exit(EXIT_FAILURE);
}
Jun 27 '08 #6
Tomás Ó hÉilidhe wrote:
Others have explained the padding situation, but if you want re-
assurance, you might add a routine to the start of your code that
makes sure it's OK:

void EnsureItWorks(void)
{
Vector const v = { 99, 56, 42 };

if (99 == (&v.x)[0] &&
56 == (&v.x)[1] &&
42 == (&v.x)[2]) return;

puts("ERROR: There's padding in the Vector struct.");

exit(EXIT_FAILURE);
}

int main(void) { EnsureItWorks(); }
A very verbose way of writing

int main()
{
assert( sizeof(vector)==sizeof(double)*3);
}

--
Ian Collins.
Jun 27 '08 #7
Hi

On Sun, 15 Jun 2008 10:51:28 +1200, Ian Collins wrote:
Tomás Ó hÉilidhe wrote:
> if (99 == (&v.x)[0] &&
56 == (&v.x)[1] &&
42 == (&v.x)[2]) return;
puts("ERROR: There's padding in the Vector struct.");
exit(EXIT_FAILURE);
A very verbose way of writing
assert( sizeof(vector)==sizeof(double)*3);
The two are not equivalent and neither is perfect. Better is:

assert( offsetof(vector,y) == sizeof(double)
&& offsetof(vector,z) == sizeof(double)*2 );

viza
Jun 27 '08 #8
viza wrote:
Hi

On Sun, 15 Jun 2008 10:51:28 +1200, Ian Collins wrote:
>Tomás Ó hÉilidhe wrote:
>> if (99 == (&v.x)[0] &&
56 == (&v.x)[1] &&
42 == (&v.x)[2]) return;
puts("ERROR: There's padding in the Vector struct.");
exit(EXIT_FAILURE);
>A very verbose way of writing
assert( sizeof(vector)==sizeof(double)*3);

The two are not equivalent and neither is perfect. Better is:

assert( offsetof(vector,y) == sizeof(double)
&& offsetof(vector,z) == sizeof(double)*2 );
Why?

Anyway, if offsetof(vector,z) == sizeof(double)*2, how can
offsetof(vector,y) be anything other than sizeof(double)?

--
Ian Collins.
Jun 27 '08 #9
Ian Collins <ia******@hotmail.comwrites:
Tomás Ó hÉilidhe wrote:
>Others have explained the padding situation, but if you want re-
assurance, you might add a routine to the start of your code that
makes sure it's OK:

void EnsureItWorks(void)
{
Vector const v = { 99, 56, 42 };

if (99 == (&v.x)[0] &&
56 == (&v.x)[1] &&
42 == (&v.x)[2]) return;
(&v.x)[0] is guaranteed to be correct. The other two can be better
tested just by ensuring that

&v.x + 2 == &v.z

The value test could give a false positive if the padding between
elements happened to have the "right" value.
> puts("ERROR: There's padding in the Vector struct.");
exit(EXIT_FAILURE);
}

int main(void) { EnsureItWorks(); }
A very verbose way of writing

int main()
{
assert( sizeof(vector)==sizeof(double)*3);
}
Except the structure can have padding at the end and still be suitable.

--
Ben.
Jun 27 '08 #10
Ian Collins <ia******@hotmail.comwrites:
viza wrote:
>Hi

On Sun, 15 Jun 2008 10:51:28 +1200, Ian Collins wrote:
>>Tomás Ó hÉilidhe wrote:
>>> if (99 == (&v.x)[0] &&
56 == (&v.x)[1] &&
42 == (&v.x)[2]) return;
puts("ERROR: There's padding in the Vector struct.");
exit(EXIT_FAILURE);
>>A very verbose way of writing
assert( sizeof(vector)==sizeof(double)*3);

The two are not equivalent and neither is perfect. Better is:

assert( offsetof(vector,y) == sizeof(double)
&& offsetof(vector,z) == sizeof(double)*2 );
Why?
Tomás's code is over complex (one test is enough) and could fail in
unusual cases (see my other posting) and your test will be thrown if
there is padding at the end of the struct.
Anyway, if offsetof(vector,z) == sizeof(double)*2, how can
offsetof(vector,y) be anything other than sizeof(double)?
Agreed. I still prefer my address test, though.

By the way, This is all about making the best of a bad job. To the
OP: if you want to index things, make them an array as Keith Thompson
suggested. In addition to using #define to name the elements one
could also do:

typedef struct {
double v[3];
} vector;

enum { x, y, z };

vector point;

so that one can write point.v[x] and so on (even x[&point] if you
want to make your readers do a double-take!).

--
Ben.
Jun 27 '08 #11
Ben Bacarisse wrote:
Ian Collins <ia******@hotmail.comwrites:
>viza wrote:
>>Hi

On Sun, 15 Jun 2008 10:51:28 +1200, Ian Collins wrote:
Tomás Ó hÉilidhe wrote:
if (99 == (&v.x)[0] &&
56 == (&v.x)[1] &&
42 == (&v.x)[2]) return;
puts("ERROR: There's padding in the Vector struct.");
exit(EXIT_FAILURE);
A very verbose way of writing
assert( sizeof(vector)==sizeof(double)*3);
The two are not equivalent and neither is perfect. Better is:

assert( offsetof(vector,y) == sizeof(double)
&& offsetof(vector,z) == sizeof(double)*2 );
Why?

Tomás's code is over complex (one test is enough) and could fail in
unusual cases (see my other posting) and your test will be thrown if
there is padding at the end of the struct.
OK, make it

assert( sizeof(vector[2])==sizeof(double)*6 );

Or even a compile time assert:

const int n = 1/( sizeof(vector[2])==sizeof(double)*6 );
>Anyway, if offsetof(vector,z) == sizeof(double)*2, how can
offsetof(vector,y) be anything other than sizeof(double)?

Agreed. I still prefer my address test, though.
Fair enough, but the simplified offsetof (or sizeof) test has the
(small) advantage of not requiring an instance of vector to test.
Saying that, the address test could be evaluated at compile time, so the
vector would be eliminated by an optimiser.

--
Ian Collins.
Jun 27 '08 #12
Ian Collins <ia******@hotmail.comwrites:
Ben Bacarisse wrote:
>Ian Collins <ia******@hotmail.comwrites:
>>viza wrote:
Hi

On Sun, 15 Jun 2008 10:51:28 +1200, Ian Collins wrote:
Tomás Ó hÉilidhe wrote:
> if (99 == (&v.x)[0] &&
> 56 == (&v.x)[1] &&
> 42 == (&v.x)[2]) return;
> puts("ERROR: There's padding in the Vector struct.");
> exit(EXIT_FAILURE);
A very verbose way of writing
assert( sizeof(vector)==sizeof(double)*3);
The two are not equivalent and neither is perfect. Better is:

assert( offsetof(vector,y) == sizeof(double)
&& offsetof(vector,z) == sizeof(double)*2 );

Why?

Tomás's code is over complex (one test is enough) and could fail in
unusual cases (see my other posting) and your test will be thrown if
there is padding at the end of the struct.
OK, make it

assert( sizeof(vector[2])==sizeof(double)*6 );

Or even a compile time assert:

const int n = 1/( sizeof(vector[2])==sizeof(double)*6 );
I think that this:

sizeof(vector) == sizeof(double) * 3

would suffice. An array of two thingies must have twice the size of a
single thingie, for any applicable value of "thingie".

[snip]

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 27 '08 #13
On Jun 15, 5:27 am, Keith Thompson <ks...@mib.orgwrote:
Ian Collins <ian-n...@hotmail.comwrites:
Ben Bacarisse wrote:
Ian Collins <ian-n...@hotmail.comwrites:
>viza wrote:
Hi
>>On Sun, 15 Jun 2008 10:51:28 +1200, Ian Collins wrote:
Tomás Ó hÉilidhe wrote:
if (99 == (&v.x)[0] &&
56 == (&v.x)[1] &&
42 == (&v.x)[2]) return;
puts("ERROR: There's padding in the Vector struct.");
exit(EXIT_FAILURE);
A very verbose way of writing
assert( sizeof(vector)==sizeof(double)*3);
The two are not equivalent and neither is perfect. Better is:
>>assert( offsetof(vector,y) == sizeof(double)
&& offsetof(vector,z) == sizeof(double)*2 );
>Why?
Tomás's code is over complex (one test is enough) and could fail in
unusual cases (see my other posting) and your test will be thrown if
there is padding at the end of the struct.
OK, make it
assert( sizeof(vector[2])==sizeof(double)*6 );
Or even a compile time assert:
const int n = 1/( sizeof(vector[2])==sizeof(double)*6 );

I think that this:

sizeof(vector) == sizeof(double) * 3

would suffice. An array of two thingies must have twice the size of a
single thingie, for any applicable value of "thingie".
vector is not an array, it's a struct.
This:
struct vector { double x, y, z; };
sizeof(struct vector)
Needs not to evaluate to sizeof (double) * 3.
If it were a vector (array), then yes, it is guaranteed and you are
correct.
But vector is a struct.

Thomas: Please change your name to ASCII.
Jun 27 '08 #14
Keith Thompson wrote:
Ian Collins <ia******@hotmail.comwrites:
>Ben Bacarisse wrote:
>>Tomás's code is over complex (one test is enough) and could fail in
unusual cases (see my other posting) and your test will be thrown if
there is padding at the end of the struct.
OK, make it

assert( sizeof(vector[2])==sizeof(double)*6 );

Or even a compile time assert:

const int n = 1/( sizeof(vector[2])==sizeof(double)*6 );

I think that this:

sizeof(vector) == sizeof(double) * 3

would suffice. An array of two thingies must have twice the size of a
single thingie, for any applicable value of "thingie".
It would, my last suggestion was pointless. It would still fail if
there were padding at the end of the struct. I would still use the one
above, the chances of padding at the end but not in the middle are slim.

--
Ian Collins.
Jun 27 '08 #15
vi******@gmail.com said:

<snip>
Thomas: Please change your name to ASCII.
Won't that get rather confusing?

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 27 '08 #16
vi******@gmail.com writes:
On Jun 15, 5:27 am, Keith Thompson <ks...@mib.orgwrote:
>Ian Collins <ian-n...@hotmail.comwrites:
Ben Bacarisse wrote:
Ian Collins <ian-n...@hotmail.comwrites:
>>viza wrote:
Hi
>>>On Sun, 15 Jun 2008 10:51:28 +1200, Ian Collins wrote:
Tomás Ó hÉilidhe wrote:
> if (99 == (&v.x)[0] &&
> 56 == (&v.x)[1] &&
> 42 == (&v.x)[2]) return;
> puts("ERROR: There's padding in the Vector struct.");
> exit(EXIT_FAILURE);
A very verbose way of writing
assert( sizeof(vector)==sizeof(double)*3);
The two are not equivalent and neither is perfect. Better is:
>>>assert( offsetof(vector,y) == sizeof(double)
&& offsetof(vector,z) == sizeof(double)*2 );
>>Why?
>Tomás's code is over complex (one test is enough) and could fail in
unusual cases (see my other posting) and your test will be thrown if
there is padding at the end of the struct.
OK, make it
assert( sizeof(vector[2])==sizeof(double)*6 );
Or even a compile time assert:
const int n = 1/( sizeof(vector[2])==sizeof(double)*6 );

I think that this:

sizeof(vector) == sizeof(double) * 3

would suffice. An array of two thingies must have twice the size of a
single thingie, for any applicable value of "thingie".
vector is not an array, it's a struct.
This:
struct vector { double x, y, z; };
sizeof(struct vector)
Needs not to evaluate to sizeof (double) * 3.
If it were a vector (array), then yes, it is guaranteed and you are
correct.
But vector is a struct.
Yes, I understand that. But vector[2] is an array type. My point
was that this:
assert(sizeof(vector[2]) == sizeof(double) * 6);
is equivalent to this:
assert(sizeof(vector) == sizeof(double) * 3);

In both cases, the asserted expression isn't guaranted to be true --
which is the whole point of the assert().

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 27 '08 #17
Ian Collins <ia******@hotmail.comwrites:
Keith Thompson wrote:
>Ian Collins <ia******@hotmail.comwrites:
>>Ben Bacarisse wrote:
>>>Tomás's code is over complex (one test is enough) and could fail in
unusual cases (see my other posting) and your test will be thrown if
there is padding at the end of the struct.

OK, make it

assert( sizeof(vector[2])==sizeof(double)*6 );

Or even a compile time assert:

const int n = 1/( sizeof(vector[2])==sizeof(double)*6 );

I think that this:

sizeof(vector) == sizeof(double) * 3

would suffice. An array of two thingies must have twice the size of a
single thingie, for any applicable value of "thingie".
It would, my last suggestion was pointless. It would still fail if
there were padding at the end of the struct. I would still use the one
above, the chances of padding at the end but not in the middle are slim.
I'd say the chances of padding at the end are higher than the chances
of padding in the middle.

Consider
struct foo { char a; char b; char c; };

It's plausible that sizeof(struct foo) == 4, with a padding byte at
the end.

This is less likely to happen for a struct containing doubles, though.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 27 '08 #18
Keith Thompson wrote:
Ian Collins <ia******@hotmail.comwrites:
>Keith Thompson wrote:
>>Ian Collins <ia******@hotmail.comwrites:
Ben Bacarisse wrote:
Tomás's code is over complex (one test is enough) and could fail in
unusual cases (see my other posting) and your test will be thrown if
there is padding at the end of the struct.
>
OK, make it

assert( sizeof(vector[2])==sizeof(double)*6 );

Or even a compile time assert:

const int n = 1/( sizeof(vector[2])==sizeof(double)*6 );
I think that this:

sizeof(vector) == sizeof(double) * 3

would suffice. An array of two thingies must have twice the size of a
single thingie, for any applicable value of "thingie".
It would, my last suggestion was pointless. It would still fail if
there were padding at the end of the struct. I would still use the one
above, the chances of padding at the end but not in the middle are slim.

I'd say the chances of padding at the end are higher than the chances
of padding in the middle.

Consider
struct foo { char a; char b; char c; };

It's plausible that sizeof(struct foo) == 4, with a padding byte at
the end.

This is less likely to happen for a struct containing doubles, though.
That why I suggested the compile time assert, it's unlikely, but worth
picking up as soon as possible.

--
Ian Collins.
Jun 27 '08 #19
Ian Collins <ia******@hotmail.comwrites:
Ben Bacarisse wrote:
>Ian Collins <ia******@hotmail.comwrites:
>>viza wrote:
Hi

On Sun, 15 Jun 2008 10:51:28 +1200, Ian Collins wrote:
Tomás Ó hÉilidhe wrote:
> if (99 == (&v.x)[0] &&
> 56 == (&v.x)[1] &&
> 42 == (&v.x)[2]) return;
> puts("ERROR: There's padding in the Vector struct.");
> exit(EXIT_FAILURE);
A very verbose way of writing
assert( sizeof(vector)==sizeof(double)*3);
The two are not equivalent and neither is perfect. Better is:

assert( offsetof(vector,y) == sizeof(double)
&& offsetof(vector,z) == sizeof(double)*2 );

Why?

Tomás's code is over complex (one test is enough) and could fail in
unusual cases (see my other posting) and your test will be thrown if
there is padding at the end of the struct.
OK, make it

assert( sizeof(vector[2])==sizeof(double)*6 );

Or even a compile time assert:

const int n = 1/( sizeof(vector[2])==sizeof(double)*6 );
I don't think any of the proposed sizeof tests work due to possible
padding at the end of the struct. I know this has been covered by
later messages, but it seems worth summarising.
>>Anyway, if offsetof(vector,z) == sizeof(double)*2, how can
offsetof(vector,y) be anything other than sizeof(double)?

Agreed. I still prefer my address test, though.
Fair enough, but the simplified offsetof (or sizeof) test has the
(small) advantage of not requiring an instance of vector to test.
Good point. That gives the offsetof version the edge, I'd say.

--
Ben.
Jun 27 '08 #20
On 14 Jun 2008 at 22:34, Tomás Ó hÉilidhe wrote:
Vector const v = { 99, 56, 42 };

if (99 == (&v.x)[0] &&
56 == (&v.x)[1] &&
42 == (&v.x)[2]) return;
Holy crap, are you trying to follow the CBF anti-style rules?
(I know that floating-point arithmetic isn't exact but as far as I
know it's exact for integer values... but I'm open to correction!)
It's nothing to do with integer values. Just passing around a
floating-point value won't magically change its bits.

In

double a=42;
double b=42.422242;
double c=1./3;
assert(a == 42);
assert(b == 42.422242);
assert(c == 1./3);

all the asserts will succeed.

Problems only arise when you start doing calculations and get
incremental rounding errors, either from separate steps in the
calculation, or from single steps where the compiled code uses a
temporary, or from type conversions (e.g. float promoted to double).

Jun 27 '08 #21
On 15 Jun 2008 at 3:56, vi******@gmail.com wrote:
Thomas: Please change your name to ASCII.
Probably he cares more about making a nationalist point than making life
simpler for people using non-unicode aware terminals/newsreaders. It's
interesting that most Russian, Chinese and Japanese posters are able to
swallow their pride enough to Latinize their names.

Jun 27 '08 #22
Antoninus Twink <no****@nospam.invalidwrites:
On 15 Jun 2008 at 3:56, vi******@gmail.com wrote:
>Thomas: Please change your name to ASCII.

Probably he cares more about making a nationalist point than making life
simpler for people using non-unicode aware terminals/newsreaders. It's
interesting that most Russian, Chinese and Japanese posters are able to
swallow their pride enough to Latinize their names.
Well, that helps me get a clearer picture of how you see the world.

I think it is quite reasonable that people should be able to spell
their names correctly, but that argument will be lost on someone who
does not even dare let their name be know.

--
Ben.
Jun 27 '08 #23
Ben Bacarisse wrote:
Antoninus Twink <no****@nospam.invalidwrites:
>On 15 Jun 2008 at 3:56, vi******@gmail.com wrote:
>>Thomas: Please change your name to ASCII.

Probably he cares more about making a nationalist point than making
life simpler for people using non-unicode aware
terminals/newsreaders. It's interesting that most Russian, Chinese
and Japanese posters are able to swallow their pride enough to
Latinize their names.

Well, that helps me get a clearer picture of how you see the world.

I think it is quite reasonable that people should be able to spell
their names correctly, but that argument will be lost on someone who
does not even dare let their name be know.
Just curious: what makes you believe that Antonius Twink is not a real name?

There are quite a few 'regulars' here that obviously don't use real names,
Default User for example and quite a few where it's hard to tell whether
it's a nick, a first or a last name. To me Antonius Twink /apperas/ to be a
real name.

Bye, Jojo
Jun 27 '08 #24
Antoninus Twink wrote:
On 14 Jun 2008 at 22:34, Tomás Ó hÉilidhe wrote:
> Vector const v = { 99, 56, 42 };

if (99 == (&v.x)[0] &&
56 == (&v.x)[1] &&
42 == (&v.x)[2]) return;

Holy crap, are you trying to follow the CBF anti-style rules?
>(I know that floating-point arithmetic isn't exact but as far as I
know it's exact for integer values... but I'm open to correction!)

It's nothing to do with integer values. Just passing around a
floating-point value won't magically change its bits.

In

double a=42;
double b=42.422242;
double c=1./3;
assert(a == 42);
assert(b == 42.422242);
assert(c == 1./3);

all the asserts will succeed.
I think you're missing the point. Tomás wantes to check whether it is safe
to assume that struct {double a;double; double c;} can be interpreted as
double[3], i.e. whether there are any padding bytes in the struct that would
prevent that.
And it seems on anything but a DS9K it is save to assume that no padding
bytes are between the members (of equal typr), but it is very well possible
that there are some after the last member.

Bye, Jojo
Bye, Jojo
Jun 27 '08 #25
Joachim Schmitz wrote:
Ben Bacarisse wrote:
>Antoninus Twink <no****@nospam.invalidwrites:
>>On 15 Jun 2008 at 3:56, vi******@gmail.com wrote:
Thomas: Please change your name to ASCII.

Probably he cares more about making a nationalist point than making
life simpler for people using non-unicode aware
terminals/newsreaders. It's interesting that most Russian, Chinese
and Japanese posters are able to swallow their pride enough to
Latinize their names.

Well, that helps me get a clearer picture of how you see the world.

I think it is quite reasonable that people should be able to spell
their names correctly, but that argument will be lost on someone who
does not even dare let their name be know.
Just curious: what makes you believe that Antonius Twink is not a real
name?

There are quite a few 'regulars' here that obviously don't use real
names, Default User for example and quite a few where it's hard to
tell whether it's a nick, a first or a last name. To me Antonius Twink
/apperas/ to be a real name.
I suppose it's the Twink part that leads people to think he is a pseudo.
Also Antoninus isn't IME a very common name either. Besides he used to
(still does?) troll clc for a long time. It's unlikely that he is
stupid enough to troll under his real name.

Jun 27 '08 #26
Ben Bacarisse <be********@bsb.me.ukwrites:
Antoninus Twink <no****@nospam.invalidwrites:
>On 15 Jun 2008 at 3:56, vi******@gmail.com wrote:
>>Thomas: Please change your name to ASCII.

Probably he cares more about making a nationalist point than making life
simpler for people using non-unicode aware terminals/newsreaders. It's
interesting that most Russian, Chinese and Japanese posters are able to
swallow their pride enough to Latinize their names.

Well, that helps me get a clearer picture of how you see the world.

I think it is quite reasonable that people should be able to spell
their names correctly, but that argument will be lost on someone who
does not even dare let their name be know.
You appear to have totally missed the point. If you re-read Twinks reply
then all the necessary points are therein.

Hint : Most usenet posting Germans convert the German characters to
"oe", "ae" and "ss" etc as appropriate.
Jun 27 '08 #27

"pereges" <Br*****@gmail.comwrote in message news:
30**********************************...oglegroups.com...

For something more robust you can try helper functions like get() and
set(), or work with pointers using getp():

#include <stdio.h>

typedef struct
{
double x, y, z;
}vector;

double *getp(vector *p,int i){
if (i==0) return &(p->x);
if (i==1) return &(p->y);
return &(p->z);
}

double get(vector *p,int i){
if (i==0) return p->x;
if (i==1) return p->y;
return p->z;
}

void set(vector *p,int i,double a){
if (i==0) {p->x=a; return;}
if (i==1) {p->y=a; return;}
p->z=a;
}

int main(void)
{
int i;
vector v;

for (i=0; i<3; ++i)
set(&v,i,(i+1)*10);

for(i = 0; i < 3; i++)
printf("%f\n", get(&v,i));

return 0;
}

Where you are sure the struct is laid out like an array, the contents
of get/set/getp can be simplied to a single line (possibly inlined).
But your main code doesn't change.

--
Bartc
Jun 27 '08 #28
In article <sl*******************@nospam.invalid>,
Antoninus Twink <no****@nospam.invalidwrote:
>Probably he cares more about making a nationalist point than making life
simpler for people using non-unicode aware terminals/newsreaders. It's
interesting that most Russian, Chinese and Japanese posters are able to
swallow their pride enough to Latinize their names.
His name is perfectly Latinised. It just isn't Anglicised. Unless
you take "Latin" to be what the ancient Romans used, in which case
your own name isn't Latinised.

-- Richard
--
In the selection of the two characters immediately succeeding the numeral 9,
consideration shall be given to their replacement by the graphics 10 and 11 to
facilitate the adoption of the code in the sterling monetary area. (X3.4-1963)
Jun 27 '08 #29
In article <g3**********@online.de>,
Joachim Schmitz <jo**@schmitz-digital.dewrote:
>Antoninus Twink <no****@nospam.invalidwrites:
[...]
>Just curious: what makes you believe that Antonius Twink is not a real name?
The fact that you've misread it might be taken as a clue.

-- Richard
--
In the selection of the two characters immediately succeeding the numeral 9,
consideration shall be given to their replacement by the graphics 10 and 11 to
facilitate the adoption of the code in the sterling monetary area. (X3.4-1963)
Jun 27 '08 #30
Richard Tobin wrote:
In article <g3**********@online.de>,
Joachim Schmitz <jo**@schmitz-digital.dewrote:
>>Antoninus Twink <no****@nospam.invalidwrites:
[...]
>Just curious: what makes you believe that Antonius Twink is not a
real name?

The fact that you've misread it might be taken as a clue.
True. I only now realized the additional n

Bye, Jojo
Jun 27 '08 #31
Richard wrote:
Ben Bacarisse <be********@bsb.me.ukwrites:
>Antoninus Twink <no****@nospam.invalidwrites:
>>On 15 Jun 2008 at 3:56, vi******@gmail.com wrote:
Thomas: Please change your name to ASCII.

Probably he cares more about making a nationalist point than making
life simpler for people using non-unicode aware
terminals/newsreaders. It's interesting that most Russian, Chinese
and Japanese posters are able to swallow their pride enough to
Latinize their names.

Well, that helps me get a clearer picture of how you see the world.

I think it is quite reasonable that people should be able to spell
their names correctly, but that argument will be lost on someone who
does not even dare let their name be know.

You appear to have totally missed the point. If you re-read Twinks
reply then all the necessary points are therein.

Hint : Most usenet posting Germans convert the German characters to
"oe", "ae" and "ss" etc as appropriate.
In Postings yes, but not neccessarily in Names

Bye, Jojo
Jun 27 '08 #32
Ben Bacarisse <be********@bsb.me.ukwrites:
Antoninus Twink <no****@nospam.invalidwrites:
>On 15 Jun 2008 at 3:56, vi******@gmail.com wrote:
>>Thomas: Please change your name to ASCII.

Probably he cares more about making a nationalist point than making life
simpler for people using non-unicode aware terminals/newsreaders. It's
interesting that most Russian, Chinese and Japanese posters are able to
swallow their pride enough to Latinize their names.

Well, that helps me get a clearer picture of how you see the world.

I think it is quite reasonable that people should be able to spell
their names correctly, but that argument will be lost on someone who
does not even dare let their name be know.
Please don't feed the troll.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 27 '08 #33
On 15 Jun 2008 at 11:46, Joachim Schmitz wrote:
I think you're missing the point. Tomás wantes to check whether it is safe
to assume that struct {double a;double; double c;} can be interpreted as
double[3], i.e. whether there are any padding bytes in the struct that would
prevent that.
Yes, I got that - I was just commenting on Thomas's seeming confustion
on how floating-point numbers behave.

Jun 27 '08 #34
On 15 Jun 2008 at 11:17, Ben Bacarisse wrote:
Antoninus Twink <no****@nospam.invalidwrites:
>Probably he cares more about making a nationalist point than making life
simpler for people using non-unicode aware terminals/newsreaders. It's
interesting that most Russian, Chinese and Japanese posters are able to
swallow their pride enough to Latinize their names.

Well, that helps me get a clearer picture of how you see the world.
I passed no judgment, but merely tried to explain Thomas's likely
thinking.
I think it is quite reasonable that people should be able to spell
their names correctly, but that argument will be lost on someone who
does not even dare let their name be know.
Thomas can and should do what he likes. I very rarely read Usenet other
than in a Unicode-aware environment, but when I do it's a pain to have
the terminal screwed up by Thomas or Harold van Dijk's non-ASCII
characters. People with strange characters in their name need to decide
whether it's more important to use the "right" spelling of their name,
or to maximize the number of people who can read their messages without
a problem. I pointed out that Thomas makes a decision that's different
from many other people - I neither endorse nor condemn him for that.

Jun 27 '08 #35
Antoninus Twink wrote:
On 15 Jun 2008 at 11:17, Ben Bacarisse wrote:
>Antoninus Twink <no****@nospam.invalidwrites:
>>Probably he cares more about making a nationalist point than making
life simpler for people using non-unicode aware
terminals/newsreaders. It's interesting that most Russian, Chinese
and Japanese posters are able to swallow their pride enough to
Latinize their names.

Well, that helps me get a clearer picture of how you see the world.

I passed no judgment, but merely tried to explain Thomas's likely
thinking.
>I think it is quite reasonable that people should be able to spell
their names correctly, but that argument will be lost on someone who
does not even dare let their name be know.

Thomas can and should do what he likes. I very rarely read Usenet
other than in a Unicode-aware environment, but when I do it's a pain
to have the terminal screwed up by Thomas or Harold van Dijk's
non-ASCII characters. People with strange characters in their name
need to decide whether it's more important to use the "right"
spelling of their name, or to maximize the number of people who can
read their messages without a problem. I pointed out that Thomas
makes a decision that's different from many other people - I neither
endorse nor condemn him for that.
And you mis-transcribe/-spell them, there's no h in Tomás and no o in
Harald. And nothing in these characters is funny.

Bye, Jojo
Jun 27 '08 #36
On Jun 15, 11:46*am, Antoninus Twink <nos...@nospam.invalidwrote:
Probably he cares more about making a nationalist point than making life
simpler for people using non-unicode aware terminals/newsreaders.

Accurate observation, even for a trolling thick.

It's
interesting that most Russian, Chinese and Japanese posters are able to
swallow their pride enough to Latinize their names.

I've always hastened to use the cliché term "There's nothing worse
than X", but in this case they're the only words that come to me:
There's nothing worse than a people without pride. There's plenty of
immigrants in the town where I live. There's Eastern Europeans.
There's black Africans. While I'm not overjoyed with immigrants taking
natives' jobs and accommodation, I don't bear any real animosity or
hatred towards them. Some of them are really nice people, and they're
just here to make a better life for themselves. In fact, their
ambition in life is something a lot of people could aspire to. The
black Africans in particular tend to be extremely pleasant friendly
people; I can smile and say hello to a complete stranger black
African, and he'll say hello back with a warm smile. If I were to do
that to any other stranger, the person would look at me like I'm a
weirdo.

But then there's one immigrant people here that I truly despise: Roma
gypsies. These people have no pride whatsoever. They really are rats.
They come into my country illegally and create encapments at motorway
junctions. They teach their children how to walk in a way that makes
their bare leg look mangled, and then they send their kids to beg
between cars on the road at a busy motorway junction. They have a
mouth full of gold teeth (yes, actual gold, the rare chemical
element), and they drive BMW cars (for those who don't know, BMW is a
luxury car make), but yet they send their children to beg on the
roads. They don't wash their bodies.

Lastnight I was in a shop in my hometime where a friend of mine works.
A Roma gypsie man came up to the counter and asked if anyone could
read a German letter for him. I like to give people the benefit of the
doubt and to be open to friendship with new people, but in this case
this was very naive of me. I read the letter aloud for him. Next, as I
was leaving, he came over to me and snooped around at my car asking me
how much I'd sell it to him for. Again, being naive I plainly told him
"No sorry, I need this car to get to work, it's not for sale" while he
snooped around the car looking in my driver's door.

When I got home, I noticed something was missing. Something which I
had when I was reading the letter for him, but which was gone by the
time I got into my car.

Now up until that point, I'd never been a fan of Roma gypsies, but at
the same time I'd no real animosity or hatred for them. Now though, I
don't even see them as people. There are friends of mine who work in
shops that have had far more experience with Roma gypsies than I have,
but I've never really understood the venomous hatred my friends have
had for them. But now, I understand.

But I digress, there's nothing worse than a people without pride. I'm
Irish, and I'm from Ireland. The vast majority of people in my country
have English names, you'll see "Stephen McAteer" instead of "Stiofán
Mac an tSaoir". Now if they feel comfortable with that, then that's
fine. But personally I don't feel comfortable as an Irish person with
an English name. I'm Irish, I speak Irish and I've an Irish name.
Suits me much better.
Jun 27 '08 #37
On Jun 14, 10:37*pm, pereges <Brol...@gmail.comwrote:
i don't how it happens as i was just trying some random ideas but
great stuff really. helped me to reduce some of my code to almost
1/3rd its size.
What you are doing invokes undefined behaviour.

As soon as you are using an optimising compiler, there are excellent
chances that your code will run into serious trouble.

For example, optimising compilers will often keep all the members of a
struct in registers; so whether a program uses your "vector" or three
doubles would make no difference. Since you take the address of v.x,
the compiler could decide to put v.x into memory, and v.y and v.z into
two floating-point registers. Your loop prints v.x plus the contents
of the memory following it, instead of v.y and v.z. This is legal and
correct under the "as if" rule.

Jun 27 '08 #38
Tomás Ó hÉilidhe said:

<snip>
But then there's one immigrant people here that I truly despise: Roma
gypsies.
<snipped: anecdote of alleged theft by Roma gypsy>
Now up until that point, I'd never been a fan of Roma gypsies, but at
the same time I'd no real animosity or hatred for them. Now though, I
don't even see them as people.
<snip>
But I digress, there's nothing worse than a people without pride. I'm
Irish, and I'm from Ireland.
One Roma gypsy (allegedly) steals from you, and now you say that, as a result
of this, you don't even see them as people.

Quite a few Irish people have been responsible for the indiscriminate killing
of a great many people since the 1960s. By *your* logic, we should despise
the Irish and not see /them/ as people. We should accord them no rights, and
give them no quarter.

Fortunately for the world, not everyone is as bigoted as you.

Tarring an entire people with a single brush is /never/ appropriate.

<snip>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 27 '08 #39
Richard Heathfield <rj*@see.sig.invalidwrites:
Tomás Ó hÉilidhe said:

<snip>
>But then there's one immigrant people here that I truly despise: Roma
gypsies.

<snipped: anecdote of alleged theft by Roma gypsy>
>Now up until that point, I'd never been a fan of Roma gypsies, but at
the same time I'd no real animosity or hatred for them. Now though, I
don't even see them as people.

<snip>
>But I digress, there's nothing worse than a people without pride. I'm
Irish, and I'm from Ireland.

One Roma gypsy (allegedly) steals from you, and now you say that, as a result
of this, you don't even see them as people.

Quite a few Irish people have been responsible for the indiscriminate killing
of a great many people since the 1960s. By *your* logic, we should despise
the Irish and not see /them/ as people. We should accord them no rights, and
give them no quarter.

Fortunately for the world, not everyone is as bigoted as you.

Tarring an entire people with a single brush is /never/ appropriate.

<snip>
I find it interesting that Twink's initial guess at the pretentious
insistence on the Irish spelling (which IS a pain the arse for non
unicode compliant newreaders and browsers) was actually quite
correct. As an Irish man myself I would like to distance myself and
others from the ridiculously blatant hatred and racism shown by Tomas
above. It is a sad reflection on current life in Ireland that the boom
in immigration has revealed many people to be worse than those (the
English) they have criticised for so many years.

Jun 27 '08 #40
Richard wrote:
Richard Heathfield <rj*@see.sig.invalidwrites:
>Tomás Ó hÉilidhe said:

<snip>
>>But then there's one immigrant people here that I truly despise:
Roma gypsies.

<snipped: anecdote of alleged theft by Roma gypsy>
>>Now up until that point, I'd never been a fan of Roma gypsies, but
at the same time I'd no real animosity or hatred for them. Now
though, I don't even see them as people.

<snip>
>>But I digress, there's nothing worse than a people without pride.
I'm Irish, and I'm from Ireland.

One Roma gypsy (allegedly) steals from you, and now you say that, as
a result of this, you don't even see them as people.

Quite a few Irish people have been responsible for the indiscriminate
killing of a great many people since the 1960s. By *your* logic, we
should despise the Irish and not see /them/ as people. We should
accord them no rights, and give them no quarter.

Fortunately for the world, not everyone is as bigoted as you.

Tarring an entire people with a single brush is /never/ appropriate.

<snip>

I find it interesting that Twink's initial guess at the pretentious
insistence on the Irish spelling (which IS a pain the arse for non
unicode compliant newreaders and browsers) was actually quite
correct. As an Irish man myself I would like to distance myself and
others from the ridiculously blatant hatred and racism shown by Tomas
above. It is a sad reflection on current life in Ireland that the boom
in immigration has revealed many people to be worse than those (the
English) they have criticised for so many years.
Can the Roma properly be called as immigrants? One would've thought that
they have a presence in Ireland for at least a few centuries now.

Jun 27 '08 #41
On 15 Jun 2008 at 18:26, santosh wrote:
Can the Roma properly be called as immigrants? One would've thought that
they have a presence in Ireland for at least a few centuries now.
I believe Thomas was directing his racist rant against immigrant Roma
gypsies specifically, rather than the home-grown/naturalized Irish
tinkers.

Jun 27 '08 #42
On Jun 15, 6:57*pm, Richard Heathfield <r...@see.sig.invalidwrote:
<snipped: anecdote of alleged theft by Roma gypsy>

I've just been back from that shop I was in and my mate had a look
over the cameras with me. I put the object on the roof of my car as I
was talking to the gypsie, and as I turned around to unlock my door he
swiped it an put it in his coat. The camera shows it clearly.

One Roma gypsy (allegedly) steals from you, and now you say that, as a result
of this, you don't even see them as people.

Not allegedly, definitely. Witnessing their thievery first-hand was
the straw that broke the camel's back. Up until then I was well aware
of their reputation as being a dirty filthy race of people, but the
idea hadn't been cemented in my mind as I hadn't witnessed it first-
hand.

Quite a few Irish people have been responsible for the indiscriminate killing
of a great many people since the 1960s. By *your* logic, we should despise
the Irish and not see /them/ as people. We should accord them no rights, and
give them no quarter.

If I'd been robbed by a German I would _not_ have tarred them all with
the same brush. Same goes for an American. Or a Japanese person.

Roma gypsies are a different animal altogether.

Fortunately for the world, not everyone is as bigoted as you.

Tarring an entire people with a single brush is /never/ appropriate.

People have prejudices for a reason. If I had no prejudice, I'd be
robbed daily. From now on, I won't allow a Roman gypsie within a foot
of me.

I suggest we drop this conversation, given the forum. Plus it's the
kind of conversation that turns sour very quickly. If you really want
to continue you can send me private e-mail.
Jun 27 '08 #43
Tomás Ó hÉilidhe <to*@lavabit.comwrites:
On Jun 15, 6:57Â*pm, Richard Heathfield <r...@see.sig.invalidwrote:
><snipped: anecdote of alleged theft by Roma gypsy>


I've just been back from that shop I was in and my mate had a look
over the cameras with me. I put the object on the roof of my car as I
was talking to the gypsie, and as I turned around to unlock my door he
swiped it an put it in his coat. The camera shows it clearly.

>One Roma gypsy (allegedly) steals from you, and now you say that, as a result
of this, you don't even see them as people.


Not allegedly, definitely. Witnessing their thievery first-hand was
the straw that broke the camel's back. Up until then I was well aware
of their reputation as being a dirty filthy race of people, but the
idea hadn't been cemented in my mind as I hadn't witnessed it first-
hand.

>Quite a few Irish people have been responsible for the indiscriminate killing
of a great many people since the 1960s. By *your* logic, we should despise
the Irish and not see /them/ as people. We should accord them no rights, and
give them no quarter.


If I'd been robbed by a German I would _not_ have tarred them all with
the same brush. Same goes for an American. Or a Japanese person.

Roma gypsies are a different animal altogether.
Hitler would have agreed with you.
Jun 27 '08 #44
On Jun 15, 8:53*pm, Keith Thompson <ks...@mib.orgwrote:
You are of course free to accept or ignore my advice.

I post from Google Groups. Does Google Groups not do the character
encoding thing on my name?
Jun 27 '08 #45
On 15 Jun 2008 at 18:55, Tomás Ó hÉilidhe wrote:
I suggest we drop this conversation, given the forum. Plus it's the
kind of conversation that turns sour very quickly.
Yes, it's amazing how conversations quickly turn sour when someone
introduces a racist tirade into them.

Jun 27 '08 #46
Tomás Ó hÉilidhe said:

<racist rant snipped>
>Fortunately for the world, not everyone is as bigoted as you.

Tarring an entire people with a single brush is /never/ appropriate.


People have prejudices for a reason. If I had no prejudice, I'd be
robbed daily. From now on, I won't allow a Roman gypsie within a foot
of me.
If I paid attention to the opinions of bigots, I'd be at risk of becoming a
bigot myself. But I'm not going to assume that all Irishmen are bigots, just
because you are.
I suggest we drop this conversation, given the forum.
I suggest you drop the racism, for your own sake. Hatred is not good for you.
Plus it's the kind of conversation that turns sour very quickly.
You are *way* too late for that.
If you really want to continue you can send me private e-mail.
I have nothing to say to you in private. It seems clear that there isn't much
point saying anything to you in public, either. So - welcome to my bozo bin.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Jun 27 '08 #47
In article <sl*******************@nospam.invalid>,
Antoninus Twink <no****@nospam.invalidwrote:
>On 15 Jun 2008 at 18:55, Tomás Ó hÉilidhe wrote:
>I suggest we drop this conversation, given the forum. Plus it's the
kind of conversation that turns sour very quickly.

Yes, it's amazing how conversations quickly turn sour when someone
introduces a racist tirade into them.
Yeah. Funny how that works, isn't it? You'd think people could do
better, regardless of the subject matter, but you just don't see it
working out that way in practice.

Jun 27 '08 #48
On Jun 15, 10:28*pm, Richard Heathfield <r...@see.sig.invalidwrote:
If I paid attention to the opinions of bigots, I'd be at risk of becoming a
bigot myself. But I'm not going to assume that all Irishmen are bigots, just
because you are.

The word "bigot" isn't used by my generation, I had to look it up. I
got the following definition from the internet:

"A person who is utterly intolerant of any differing creed, belief, or
opinion."

Whether I am tolerant of a particular people depends entirely on the
people in question. Does that not make perfect sense? I know all kinds
of people, all different nationalities and religions. I know
Catholics, Muslims, Sikhs, Hindus, a few other religions. I know
blacks, whites, asians. I know Nigerians, Scottish, Americans, French,
Germans, Belgians. My college was full of all sorts of people from all
different backgrounds, and I got on fine with all of them.

Of all the races, creeds, religions, nationalities, what have you, in
the world, I'm prejudiced against one sole group: Roma gypsies, and
it's purely from my own personal experience with them.

That's a pretty good "tolerance track record" if you ask me. And it's
not like I'm about to start a campaign for Ethnic cleansing... I'm
just not going to let a Roma gypsie near me ever again. If they come
within a metre, I'll raise my fist out in front of them and tell them
to get away from me. If they proceed further, they're going home with
less teeth. I think that's the fairest I can be about it.

I suggest you drop the racism, for your own sake. Hatred is not good for you.

Thanks for the advice, and I agree with it. But having all the warmth
in the world in my hearth won't stop Roma gypsies from exploiting
their kids and robbing me.

I don't so much have a hatred for them, I just view them as a dirty
filthy people.

I have nothing to say to you in private. It seems clear that there isn't much
point saying anything to you in public, either. So - welcome to my bozo bin.

A rare honour, I had assumed you didn't have a killfile.
Jun 27 '08 #49
Tomás Ó hÉilidhe <to*@lavabit.comwrites:
On Jun 15, 8:53*pm, Keith Thompson <ks...@mib.orgwrote:
>You are of course free to accept or ignore my advice.

I post from Google Groups. Does Google Groups not do the character
encoding thing on my name?
I don't know. Do your own research.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 27 '08 #50

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Thomas Matthews | last post by:
Hi, Given a structure of pointers: struct Example_Struct { unsigned char * ptr_buffer; unsigned int * ptr_numbers; }; And a function that will accept the structure:
4
by: Thomas Matthews | last post by:
Hi, I'm writing code for an embedded system. In the system a Timer has 4 memory mapped registers of 32-bit lengths in contiguous locations: Timer 0: 0x1000 Configuration register 0x1004...
6
by: Eric Smith | last post by:
Is a structure containing an incomplete array as its last element (per paragraph 2 of section 6.7.2.1 of ISO/IEC 9899:1999 (E)) itself an incomplete type? That appears to be indicated by paragraph...
11
by: Mannequin* | last post by:
Hi all, I'm working on a quick program to bring the Bible into memory from a text file. Anyway, I have three questions to ask. First, is my implementation of malloc () correct in the program to...
15
by: damian birchler | last post by:
Hi I'm wondering of what type a structure is. Of course, it is a _structure_, but an array isn't an _array_ either. So of what type is a structure? I'd say a pointer, am I right?
10
by: nambissan.nisha | last post by:
I am facing this problem.... I have to define a structure at runtime as the user specifies... The user will tell the number of fields,the actual fields...(maybe basic or array types or...
6
by: noone | last post by:
What is the syntax to access members of a structure without explicitly naming the structure in every access? struct mytype { int a; char* b; long c; } IT; How can I access the structure...
5
Banfa
by: Banfa | last post by:
I thought I would write a little article about this because it is regularly asked as a question in the Forums. Firstly this is a C++ issue, it is strictly against the rules of C to create a class...
5
by: =?Utf-8?B?QXlrdXQgRXJnaW4=?= | last post by:
Hi Willy, Thank you very much for your work. C++ code doesnot make any serialization. So at runtime C# code gives an serialization error at "msg_file_s sa = (msg_file_s) bf.Deserialize(ms);"...
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: 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: 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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.