|
From: | Ken Raeburn |
Subject: | Re: GNU Guile 1.9.5 released (alpha) |
Date: | Sat, 28 Nov 2009 22:44:55 -0500 |
On Nov 28, 2009, at 20:24, Linas Vepstas wrote:
googleing the error messages indicates that anonymous structs are OK in C, but are somehow bad form in C++, thus gcc generates this error. I don't understand why this would matter.
The error message you quoted refers specifically to a function taking a SCM argument. When a C++ function not declared 'extern "C"' takes an object or pointer using a struct/class type, the name of the type is used in the "name mangling" that encodes the function signature in the object-code name for the function; for example, "foo(int)" may become "_Z3fooi" (something like: _Z = function encoding prefix, 3 = length of function name, i = int), and "foo(struct x)" may become "_Z3foo1x" (1 = length of name of user-defined type), but for an anonymous type, you can't encode it.
I'm not sure of the rules for anonymous classes in C++; searching the 1998 standard I see only references to anonymous unions. My best guess is that you're just not allowed to use them for declaring objects with linkage, but I can't (so far) quote you chapter and verse to support that.
Ken
[Prev in Thread] | Current Thread | [Next in Thread] |