[bind10-dev] what to do for MSVC 4512 warnings?
Michal 'vorner' Vaner
michal.vaner at nic.cz
Mon Jul 2 11:31:28 UTC 2012
Good morning
On Mon, Jul 02, 2012 at 10:48:36AM +0000, Francis Dupont wrote:
> > I think this is not exactly what we want. If we didn't have a
> > problem with this yet, it means we don't want to assign to the
> > class. Anyway, I think it would make little sense anyway, because,
> > what would the operator do? The class is meant to be imutable.
>
> => it is not we don't want to assign instances of the class, just
> the automatic assignment operator is not provided by the compiler
> because of cont fields (BTW this is the correct behavior but
> MSVC adds a warning...).
We want the class not to be modifiable (for example some of the result classes
for data sources). That, indirectly, includes not being assignable.
> > And it shouldn't cause any kind of runtime breakage, if anyone hits
> > a problem with this, it would be a compile-time problem.
>
> => do you mean you rely on all compilers to raise an error when
> someone will try to use a not defined and not auto-generated
> assignment? With the trivial bugs I saw going through g++ without
> notice I am afraid you ask too much.
I don't think I ask too much. In this case I think it is much harder not to
error in such situation than just raise it. Because the compiler will try to
generate the operator and find out there's no option how to do it, since the
const member can't be assigned, since it has no working assignment operator
itself.
> => in fact it is a bit too strong: we only need to protect the
> assignment operator using the same style than for boost::noncopyable.
That would probably work.
> typedef nonassignable_::nonassignable nonassignable;
Just to make sure, what is the trick with the namespace for? If you create the
nonassignable name in the global namespace anyway (by the typedef), why creating
the namespace in the first place?
Thank you
--
Security warning: Do not expose this email to direct sunlight.
It may lead to undefined behaviour, including possible data or life loses.
Michal 'vorner' Vaner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <https://lists.isc.org/pipermail/bind10-dev/attachments/20120702/4b52a59b/attachment.bin>
More information about the bind10-dev
mailing list