[cairo] Problem with C++ and cairo_path_data_t

Owen Taylor otaylor at redhat.com
Thu Jun 9 07:52:02 PDT 2005

On Sat, 2005-06-04 at 18:18 -0400, Jason Dorje Short wrote:
> 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.

+typedef enum cairo_path_type_t {
+} cairo_path_type_t;

Hmm, isn't this name a bit weird? (It's not the type of the path).
Maybe cairo_path_operation_t? That's long, but there should (almost)
never be variables of the type, so it doesn't really matter.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050609/4d5fcaa9/attachment.pgp

More information about the cairo mailing list