Re: Identifying a structure by reading it's first field.

2012-06-02 Thread Ernie Wright
On 6/2/2012 11:30 AM, Chris Vine wrote: >> In part because it wasn't in the standard prior to C99, > > It was in C89 - ยง6.3: Yes, you're right. C99 added the 'restrict' keyword. > It is the fifth bullet point which permits your usage. Not my usage, but yes, along with "A pointer to a structur

Re: Identifying a structure by reading it's first field.

2012-06-02 Thread Ernie Wright
On 6/2/2012 6:16 AM, Chris Vine wrote: > You are probably also interested in the strict aliasing rule, [...] > This is an alarmingly often overlooked rule. In part because it wasn't in the standard prior to C99, which isn't supported to the degree C90 is. - Ernie

Re: Identifying a structure by reading it's first field.

2012-06-01 Thread Ernie Wright
On 6/1/2012 2:17 PM, Osmo Antero wrote: > I have couple of C structures that I want to distinguish between by > reading the structures' first (type) field. [...] > > Q: Can I assume that the "type" field is always first in the > structures, so I can read it with: NodeType type = *(NodeType*)nod

Re: Locale definitions, dots and commas

2008-03-13 Thread Ernie Wright
[EMAIL PROTECTED] wrote: > Dave Howorth wrote: >> Martin (OpenGeoMap) wrote: >> >>> you can input in a entry for example (22m, 22 m, 220cm,...) and >>> internally you have a double always in meters. >> >> How do you deal with precision? 22 m is not the same as 22.000 m > > Bad example. 22 can be

Re: type-punning warnings with optimizations turned on?

2007-07-06 Thread Ernie Wright
[EMAIL PROTECTED] wrote: > On 7/6/07, Ernie Wright <[EMAIL PROTECTED]> wrote: > >> > (now someone will tell me the compiler is correct and casting "int >> > *x[]" to "void **" is indeed wrong :-) >> >> This is question 4.

Re: type-punning warnings with optimizations turned on?

2007-07-06 Thread Ernie Wright
[EMAIL PROTECTED] wrote: > (now someone will tell me the compiler is correct and casting "int > *x[]" to "void **" is indeed wrong :-) This is question 4.9 in the C FAQ: http://c-faq.com/ptrs/genericpp.html - Ernie http://home.comcast.net/~erniew ___

Re: question regarding pixbuf

2007-03-22 Thread Ernie Wright
Alexander Eichner wrote: > i have a problem when i load images with a certain size. > Normally the rowstride given with gdk_pixbuf_get_rowstride > is calculated with width of the image multiplied with the number of > channels in the image. > But if i load an RGB Image with for example 314px*240px