[Ns-developers] Ipv4Address and Ipv4Mask, getting rid of "implicit" constructors
Gustavo Carneiro
gjcarneiro at gmail.com
Tue May 13 09:46:35 PDT 2008
Right now you can pass "1.2.3.4" to a function expecting Ipv4Address or
Ipv4Mask, and since the constructors do not have an 'explicit' keyword C++
will call the constructor automatically for us. This "feature" is used in
ns-3 src/routing/global-routing-manager, and extensively in examples.
However I always find it confusing, and it can accidentally disable some
useful type checking normally done by C++.
I would like to make all these constructors "explicit", thus you have to
type Ipv4Address ("1.2.3.4") instead of "1.2.3.4".
Comments?
--
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert
More information about the Ns-developers
mailing list