Code Question

Edward Zimmermann <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
#if !PIXMAN_HAS_COMPOSITOR

line 2996 of cairo-image-compositor.c has

  if (r->u.mask.extents.height * r->u.mask.stride > (int)sizeof (r->_buf))
where in struct _cairo_image_span_renderer  we have

line  1550:     uint8_t _buf[0];

the above is a pointer that is not allocated.  It's a zero length array.   The behavior is implementation specific and that includes throwing an error but this typically leads to the compiler seeing  sizeof (r->_buf)) as zero. GCC and Microsoft Studio accepts it. C90 hates it. C99 provides flexible array member.

If its intended to be as written, zero length, then why the comparison? Any compilers accept zero length arrays and return another value.





_________________________________________________________________
Edward C. Zimmermann
Softwareentwicklung
---
CIB software GmbH
Elektrastr. 6a
81925 München
---
T +49 (0)89 / 1 43 60 - 156
F +49 (0)89 / 1 43 60 -100
[email protected]<mailto:[email protected]>
www.cib.de<http://www.cib.de/>
---
Sitz: München
Registergericht München, HRB 123286
Geschäftsführer: Dipl.-Ing. Ulrich Brandner

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.