Afficher un message
Vieux 18/10/2007, 17h43   #5
Victor Bazarov
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Is a bug with Comeau or I miss something as Comeau says?

Barry wrote:
> Victor Bazarov wrote:
>
> Thanks V,
>
> what if I use C structs in cxx files?


There is no such thing. If you mean "what if I use POD structs
in my C++ program", then the question is legitimate. But you're
not gonna like the answer anyway, sorry. What do you mean "what
if you use C structs"?

> After the inclusion of header file
> the code looks like this:
>
> extern "C"
> {
> struct A {};
> }
>
> int main()
> {
> const A ca;
> }
>
> But we can't change the original definition of struct A.
> So we just can't declare /ca/ of /const A/ ?
>
> What's the point that the language constrains on this?


No, you just need to provide a proper initialiser:

int main()
{
const A ca = {};
}

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


  Réponse avec citation
 
Page generated in 0,06164 seconds with 9 queries