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
|