[cairo] Problem with C++ and cairo_path_data_t

Jason Dorje Short jdorje at users.sf.net
Sat Jun 4 15:18:04 PDT 2005


T Rowley wrote:
> Trying to write some code very similar to the example of walking through
> a cairo_path_t as shown in cairo.h, I've come across the problem that
> the enumerators CAIRO_PATH_* are not visible when using C++.

You can't have embedded enumerations in C++; the enumerated values
aren't visible outside of the embedding.  See

  http://david.tribble.com/text/cdiffs.htm#C99-nested-struct

The best fix is probably to unembed the enumeration, which this patch
does.  It's also possible in C++ to refer to the embedded enumeration
using the scope (something like
cairo_path_data_t::header::CAIRO_PATH_MOVE_TO), but that's ugly and the
resulting code won't work under C.

-jason


-------------- next part --------------
A non-text attachment was scrubbed...
Name: cairo_path_type_t.diff
Type: text/x-patch
Size: 756 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050604/fc49731e/cairo_path_type_t.bin


More information about the cairo mailing list