On Tuesday, 6 October 2015 at 05:38:36 UTC, Jonathan M Davis
wrote:
Your suggestion only works by assuming that the result will fit
in a char, which doesn't fit at all with how coversions are
currently done in D. It would allow for narrowing conversions
which lost data. And there's no way that
On Tuesday, 6 October 2015 at 09:28:29 UTC, Marc Schütz wrote:
I see, this is a new problem introduced by `char + int = char`.
But at least the following could be disallowed without
introducing problems:
int a = 'a';
char b = 32;
But strictly speaking, we already accept overflow
On Tuesday, October 06, 2015 09:28:27 Marc Schütz via Digitalmars-d-learn wrote:
> I see, this is a new problem introduced by `char + int = char`.
> But at least the following could be disallowed without
> introducing problems:
>
> int a = 'a';
> char b = 32;
Sure, it would be nice, but
On Monday, October 05, 2015 11:48:51 Marc Schütz via Digitalmars-d-learn wrote:
> On Monday, 5 October 2015 at 10:30:02 UTC, Jonathan M Davis wrote:
> > On Monday, October 05, 2015 09:07:34 Marc Schütz via
> > Digitalmars-d-learn wrote:
> >> I don't think math would be a problem. There are some
On Sunday, 4 October 2015 at 21:57:44 UTC, Jonathan M Davis wrote:
When appending, b to a, the elements in b are being copied onto
the end of a, and presumably it works in this case, because a
ubyte is implicitly convertible to char. But all it's doing is
converting the individual elements.
On Sunday, 4 October 2015 at 21:57:44 UTC, Jonathan M Davis wrote:
On Sunday, October 04, 2015 16:13:47 skilion via
Digitalmars-d-learn wrote:
Is this allowed by the language or it is a compiler bug ?
void main() {
char[] a = "abc".dup;
ubyte[] b = [1, 2, 3];
a = b; // cannot
On Monday, October 05, 2015 09:07:34 Marc Schütz via Digitalmars-d-learn wrote:
> On Sunday, 4 October 2015 at 21:57:44 UTC, Jonathan M Davis wrote:
> > On Sunday, October 04, 2015 16:13:47 skilion via
> > Digitalmars-d-learn wrote:
> >> Is this allowed by the language or it is a compiler bug ?
>
On Monday, 5 October 2015 at 10:30:02 UTC, Jonathan M Davis wrote:
On Monday, October 05, 2015 09:07:34 Marc Schütz via
Digitalmars-d-learn wrote:
I don't think math would be a problem. There are some obvious
rules that would likely just work with most existing code:
char + int = char
char -
Is this allowed by the language or it is a compiler bug ?
void main() {
char[] a = "abc".dup;
ubyte[] b = [1, 2, 3];
a = b; // cannot implicitly convert expression (b) of type
ubyte[] to char[]
a ~= b; // works
}
On Sunday, October 04, 2015 16:13:47 skilion via Digitalmars-d-learn wrote:
> Is this allowed by the language or it is a compiler bug ?
>
> void main() {
> char[] a = "abc".dup;
> ubyte[] b = [1, 2, 3];
> a = b; // cannot implicitly convert expression (b) of type
> ubyte[] to char[]
10 matches
Mail list logo