On Apr 18, 1:09 pm, Alberto Ganesh Barbati <AlbertoBarb...@[EMAIL PROTECTED]
>
wrote:
> Piotr Rak ha scritto:
> > The know deficiencies are:
> > - doesn't handle wide literals (should be easy),
> > and unicode literals (not in gcc yet)
>
> I guess the simplest thing is to replace the literal with a sequence of
> char, char16_t, char32_t or wchar_t according to the string literal and
> let the usual promotion and conversion machinery to happen. Were you
> think of something different?
>
Not really, promotion allowed by standard should be allowed IMO.
Adding sup****t of wide string literals (L"") and wchar_t is 3-4 lines
of code more propably...
Just haven't been done yet :)
There is no Unicode literals in gcc, again i dont think that
sup****ting them will be hard.
> > - I should re****t error in case of "" or L""
>
> Do we need to diagnose an error in this situation? Would expanding to an
> empty sequence be impossible or unreasonable?
>
Technicaly it is not, it might expand to no characters.
However:
template <char...> class Foo;
Foo<""> foo; // == Foo<> foo, Ok
//but:
Foo<"","",""> foo2; // is that Ok?
//also:
template <char> class Bar;
Bar<'a', ""> bar; // is it Ok?
It might be feature, in some cases, maybe some automated tool dumps ""
fo empty strings...
But i consider this code bit confusing, matter of taste...
So simplest solution would be just ban "".:)
Note that current version of patch has bug and will behave bad if
there is "" as template arguemnt, be warned!
> > - definitly needs testing (DejaGNU here I come!)
>
> If you need help, please contact me privately.
>
> > - and do***entation...
>
> If you need help, please contact me privately.
>
> > But overall, it should be enough to see how it feels.
>
Any help is highly welcome, I'll do that soon, thanks! :)
> > I am not sure if default template arguments should be sup****ted ie:
>
> > template <char... Chars_ = "Oink!">
> > struct Foo;
>
> > Comments welcome :)
>
> Ah! Good point. Currently default template-arguments cannot be specified
> for parameter packs. Although the feature is very appealing, I would
> leave it at that. Unless we make that a very special case, we would
> actually be forced to provide a meaning for the "equivalent" syntax:
>
> template <char... Chars_ = 'O','i','n','k','!'>
> struct Foo;
>
> and this would open a Pandora's box, IMHO.
>
> So I guess we should provide wording to disallow literals in default
> template-arguments, where replacement doesn't make sense.
Equivalent syntax is odd IMO, so that is good point.
I am not keen of providing special cases where we would allow syntax
with "", but disallow other one.
Also there is no syntax for non-character types, which would make this
feature 'asymmetric' in a language.
This is not essential, maybe we just should leave that out?
>
> > Note that, this was first time i've seen gcc sources...
>
> That means gcc sources are very well written or that you are very
> skilled or both ;)
>
I think the truth is, that sources are well do***ented, and
implementation of this feature was really trivial. :)
Almost half of patch is command line handling.
>
>
> Thanks! Now it's time to prepare a formal proposal. Let me help you with
> that.
>
Are you reading my mind?
In fact I was hoping, that someone will offer help with that.
My poor language skills could otherwise hurt this proposal. :)
Thanks again, for all your feedback and involvment. :)
Piotr
--
[ See http://www.gotw.ca/resources/clcm.htm
for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


|