Am 03.11.2013 18:33, schrieb Dmitry Dneprov:
...
Traditionally in C and C++ conversion between int and char types
was always implicit. So as your new type is used in standard
routines, I suggest support this semantic,
i.e. make this constuctor implicit.

Regards,
   Dmitry

I think you are right.

There are currently 4 constructors for cxxtools::Char with one parameter:

   Char(char ch);
   Char(unsigned char ch);
   Char(wchar_t ch);
   explicit Char(value_type ch);  // value_type beeing int32_t

This is a source of ambiguity. I think the best way is to replace all with a single constructor:

   Char(value_type ch);

Then there is no ambiguity and C++ converts all int and char types implicitly. Since the value type is int32_t, it gives the compiler even the chance to warn, if one uses a 64 bit type to initialize a Char, which may loose bits. And the user should check, if it is really what he wants.

Tommi
------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to