import core.thread.osthread : Thread;
import std.stdio : writeln;
__gshared static Thread th;
__gshared static size_t tht;
void run()
{
writeln("run");
while (tht == 0) {}
}
shared static this()
{
writeln("this");
th = new Thread().start();
On Sunday, 21 January 2024 at 20:13:38 UTC, An Pham wrote:
On Saturday, 20 January 2024 at 15:59:59 UTC, Anonymouse wrote:
I remember reading this was an issue and now I ran into it
myself.
```d
import std.stdio;
void main()
{
auto names = [ "foo", "bar", "baz" ];
void delegate()[]
On Saturday, 20 January 2024 at 15:59:59 UTC, Anonymouse wrote:
I remember reading this was an issue and now I ran into it
myself.
```d
import std.stdio;
void main()
{
auto names = [ "foo", "bar", "baz" ];
void delegate()[] dgs;
foreach (name; names)
{
dgs ~= () =>
On Saturday, 2 December 2023 at 15:30:39 UTC, zoujiaqing wrote:
```D
string appKey =
"1";
ubyte[1024] data = cast(ubyte[])(appKey.dup[0..$]);
sha256.put(data);
Your data has garbage at the end; try
import std.stdio;
void main()
{
float f = 6394763.345f;
import std.format : sformat;
char[80] vBuffer = void;
writeln("6394763.345 = ", sformat(vBuffer[], "%.4f", f));
}
Output
6394763.345 = 6394763.5000
Getting with below error for following codes. Look like bug?
onlineapp.d(61): Error: scope variable `a` assigned to non-scope
parameter `a` calling `foo`
@safe:
struct A(S = string)
{
@safe:
S s;
void delegate() c;
}
struct B(S = string)
{
On Monday, 30 March 2020 at 18:20:00 UTC, Steven Schveighoffer
wrote:
On 3/30/20 1:06 PM, Pham wrote:
Will it be the same if using "is", the reason is for function
that use "nothrow" attribute?
if (cc.classinfo is typeid(CC))
I don't really understand the question about "nothrow".
On Monday, 30 March 2020 at 15:15:08 UTC, Steven Schveighoffer
wrote:
On 3/30/20 10:38 AM, lilijreey wrote:
Hi:
I write code like this
```D
class Base
{
int base;
}
class CC :Base
{
int cc;
}
auto cc = new CC;
//I want check cc object type is CC
if (typeid(cc) == typeid(CC)) // ok ==
On Friday, 17 November 2017 at 06:21:50 UTC, Jerry A. wrote:
On Friday, 17 November 2017 at 05:08:23 UTC, pham wrote:
struct DelegateList(Args...)
{
public:
alias DelegateHandler = void delegate(Args args) nothrow;
DelegateHandler[] items;
void opCall(Args args) nothrow
{
struct DelegateList(Args...)
{
public:
alias DelegateHandler = void delegate(Args args) nothrow;
DelegateHandler[] items;
void opCall(Args args) nothrow
{
foreach (i; items)
i(args);
}
}
DelegateList!(string, int) list; // Compile OK so far
Is there a way to identify if a type is a struct, something like
isStruct
similar to isArray.
struct X
{
}
isStruct!X == true?
Also, there are isAbstractClass & isFinalClass but want to check
if type is a class regardless? something like isClass?
Thanks
Pham
On Wednesday, 16 August 2017 at 13:55:31 UTC, Steven
Schveighoffer wrote:
On 8/16/17 9:12 AM, Daniel Kozak via Digitalmars-d-learn wrote:
It should not be print? AIAIK std.utf.toUTF16 is not
deprecated: http://dlang.org/phobos/std_utf.html#toUTF16
OK this one
string s is multi-lines (CRLF as line break)
The write function will write extra CR character for each CRLF
pair -> why (bug?)
import std.file;
import std.stdio;
string s = ...;
auto fHandle = File("f:\\text.txt", "w"); // open for writing
fHandle.write(s);
fHandle.close();
Should codes below be compiled?
import std.stdio;
class Test
{
enum string[string] WorkAA =
[
"foo": "work"
];
immutable string[string] NotWorkAA1 =
[
"foo": "not work"
];
string[string] NotWorkAA2 =
14 matches
Mail list logo