Home

conrad wrote:
> What are some of the fundamental differences
> between const in C++ and const in C?
>
It works as one would expect in C++ and it's a bit broken in C?

In C, a const integer type isn't a compile time constant while in C++ it is.

>
> In C, the above is a pointer to type
> "pointer to char read-only" and so
> assignments like the following
> cannot be made:
> const char **foo;
> char **baz;
> foo = baz;
>
> But in C++, I think I remember
> reading that this works.
>
In C, you could get away with this (I'm not sure if the compiler is
required to issue a diagnostic), in C++, it is an error.

--
Ian Collins.

previous
next

Re: Porable Semaphore implemented in C++ ?
Re: list index()
Re: C++ solution for K & R(2nd Ed) Ex.6-4 - better solution needed
Re: Strange GCC warning
Re: get memory size for STL containers
xero
kosmetyka białołęka
laptopy
Witryna poświęcona czyszczeniu wykładzin
perfumy męskie