On Monday, 14 December 2020 at 05:37:21 UTC, Paul Backus wrote:
On Monday, 14 December 2020 at 05:27:40 UTC, Виталий Фадеев
wrote:
".rgb" Compiled fine.
".argb" Compilation error.
Source:
https://run.dlang.io/is/ULQ4kh
It's parsing the `.a` in `.argb` as part of the number:
auto color
On Monday, 14 December 2020 at 05:27:40 UTC, Виталий Фадеев wrote:
".rgb" Compiled fine.
".argb" Compilation error.
Source:
https://run.dlang.io/is/ULQ4kh
It's parsing the `.a` in `.argb` as part of the number:
auto color = 0x00AABBCC.a rgb; // what the compiler sees
You can fix it
On Monday, 14 December 2020 at 05:24:39 UTC, Виталий Фадеев wrote:
... msg ...
But...:
Color rgb( uint color )
{
return
Color( cast( uint ) (
( ( color & 0x00FF ) << 16 ) |
( ( color & 0xFF00 ) ) |
( (
We have:
static import winapi=core.sys.windows.windows;
struct Color
{
union
{
winapi.COLORREF native;
struct
{
ubyte r;
ubyte g;
ubyte b;
}
}
ubyte a =
On Monday, 14 December 2020 at 02:54:12 UTC, Jack wrote:
like dmd's -D flag?
dub build --build=docs
like dmd's -D flag?
On Monday, 16 November 2020 at 18:34:14 UTC, Max Haughton wrote:
[...] Probably should be a bug.
filed as Issue 21481
On Sunday, 13 December 2020 at 22:40:53 UTC, Paul Backus wrote:
This is definitely a bug.
filed as Issue 21480
On Sunday, 13 December 2020 at 21:22:16 UTC, kdevel wrote:
On Sunday, 13 December 2020 at 20:58:42 UTC, rikki cattermole
wrote:
[...]
String literals are null terminated by the compiler. It is
very useful for communicating with C.
Sure, but in the example given there is an embedded NUL
On Sunday, 13 December 2020 at 20:58:42 UTC, rikki cattermole
wrote:
[...]
String literals are null terminated by the compiler. It is very
useful for communicating with C.
Sure, but in the example given there is an embedded NUL which as
part
of an exception msg. If caught everything works
On 14/12/2020 9:56 AM, kdevel wrote:
On Sunday, 13 December 2020 at 20:25:06 UTC, KapyoniK wrote:
Is it really a bug ? \0 truncates the string, as mentionned on this
page :
https://en.wikipedia.org/wiki/Null-terminated_string
I thought the D runtime is written in D (with D strings)?!?
On Sunday, 13 December 2020 at 20:25:06 UTC, KapyoniK wrote:
Is it really a bug ? \0 truncates the string, as mentionned on
this page :
https://en.wikipedia.org/wiki/Null-terminated_string
I thought the D runtime is written in D (with D strings)?!?
On Sunday, 13 December 2020 at 11:51:19 UTC, kdevel wrote:
~~~char2.d
void main ()
{
import std.stdio;
import std.conv;
char [2] win = [0, 'X'];
auto ne = new Exception ("A " ~ win.to!string ~ " B");
try throw ne;
catch (Exception e)
writeln ("exception caught: e.msg =
On Sunday, 13 December 2020 at 16:41:06 UTC, Andrey Zherikov
wrote:
I'm trying to check that function has 'ref' parameter. The only
way I found so far is to use std.traits.Parameters.
Here is the code I have:
void f(int) {}
void g(ref int) {}
void main()
{
On Sunday, 13 December 2020 at 18:44:20 UTC, Mike Parker wrote:
On Sunday, 13 December 2020 at 18:31:54 UTC, Dave P. wrote:
Do I have to write both and have one forward to the other for
more
complicated functions?
For free functions, yes.
Is there any way to write the function as a
On Sunday, 13 December 2020 at 18:31:54 UTC, Dave P. wrote:
If I define a method on a type, then I can call it both through
a pointer and
through a reference and the compiler does the right thing. Eg:
struct Foo {
int x;
void fooey(){
x++;
}
void report(){
If I define a method on a type, then I can call it both through a
pointer and
through a reference and the compiler does the right thing. Eg:
struct Foo {
int x;
void fooey(){
x++;
}
void report(){
printf("%d\n", x);
}
}
int main(){
Foo f;
f.fooey;
On Sunday, 13 December 2020 at 17:34:26 UTC, rikki cattermole
wrote:
Did you initialize the D runtime before you called the D code?
(assuming C main).
wow, thanks for such quck response. That's exactly what I missing
in this function:
version(Posix)
{
Did you initialize the D runtime before you called the D code? (assuming
C main).
I have this D code base that when I compile to executable, it ran
fine, but when I call the very same function from C, I get this
error:
Aborting from src/core/time.d(2113)
MonoTimeImpl!(ClockType.normal) failed to get the frequency of
the system's monotonic clock.
from source code[1] I
I'm trying to check that function has 'ref' parameter. The only
way I found so far is to use std.traits.Parameters.
Here is the code I have:
void f(int) {}
void g(ref int) {}
void main()
{
writeln(Parameters!f[0].stringof);
writeln(__traits(isRef,
~~~char2.d
void main ()
{
import std.stdio;
import std.conv;
char [2] win = [0, 'X'];
auto ne = new Exception ("A " ~ win.to!string ~ " B");
try throw ne;
catch (Exception e)
writeln ("exception caught: e.msg = <", e.msg, ">");
throw ne;
}
~~~
Output:
exception
22 matches
Mail list logo