On Thursday, 25 January 2024 at 15:39:08 UTC, ryuukk_ wrote:
```D
void main()
{
char[32] id = 0;
id = "hello";
}
```
this works fine, and that is what i expect for the example
above..
Raise a bug, I'll fix it.
On Saturday, 2 December 2023 at 05:16:43 UTC, name wrote:
Minimum thing to reproduce bug:
main.d:
```d
import test;
void main() {
auto a = FILE_MAP_READ;
}
```
test.c
```c
#define SECTION_MAP_READ 0x0004
#define FILE_MAP_READ SECTION_MAP_READ
```
build with
On Tuesday, 27 December 2022 at 12:22:45 UTC, Johan wrote:
does semantic analysis (create AST; note that there is a ton of
calls needed to complete SeMa), and finally outputs object code.
If you want to capitalize the word use SemA. ;)
On Sunday, 4 December 2022 at 09:54:53 UTC, Salih Dincer wrote:
Recently DIP1044 was published about enum and although we can
use `with()` instead we waste time unnecessarily...
With cannot be used in calls.
Hence when calling a function you need to either spell out the
enum type or wrap the
On Sunday, 22 May 2022 at 23:35:11 UTC, mw wrote:
On Sunday, 22 May 2022 at 22:37:43 UTC, Stefan Koch wrote:
On Sunday, 22 May 2022 at 21:07:19 UTC, zoujiaqing wrote:
Does D language have task steal queue?
The requirements are high-performance, lock-free, and
thread-safe.
I have one called
On Sunday, 22 May 2022 at 21:07:19 UTC, zoujiaqing wrote:
Does D language have task steal queue?
The requirements are high-performance, lock-free, and
thread-safe.
I have one called fluffy:
https://github.com/UplinkCoder/fluffy
I am not 100% sure about the performance I did try to make it
On Thursday, 6 January 2022 at 12:04:12 UTC, HuskyNator wrote:
On Monday, 28 November 2016 at 14:41:44 UTC, Era Scarecrow
wrote:
On Monday, 28 November 2016 at 09:06:34 UTC, Paolo Invernizzi
wrote:
The point is that I was trying to avoid some cycle between
modules, detected by 2.072. This bug
On Tuesday, 9 November 2021 at 21:03:20 UTC, Steven Schveighoffer
wrote:
On 11/9/21 3:05 PM, Stefan Koch wrote:
Yes it is valid C.
It is not valid D though.
The file is named `tomld.c`
The way importC works is, you pass a .c file to the compiler,
and it treats it as C.
-Steve
It
On Tuesday, 9 November 2021 at 19:53:48 UTC, Steven Schveighoffer
wrote:
On 11/9/21 2:34 PM, Stefan Koch wrote:
On Tuesday, 9 November 2021 at 11:45:28 UTC, rempas wrote:
[...]
What's happening here is that dmd seems to see `free` as
function rather than a pointer to a function.
changing
On Tuesday, 9 November 2021 at 11:45:28 UTC, rempas wrote:
```
toml.c(39): Error: cannot implicitly convert expression
`malloc` of type `extern (C) void*(ulong __size)` to `extern
(C) void* function(ulong)`
toml.c(40): Error: cannot implicitly convert expression `free`
of type `extern (C)
On Thursday, 16 September 2021 at 20:53:34 UTC, Elmar wrote:
Hello D community.
I was browsing the `__traits` keywords and I found `isFuture`
whose descriptions says something about `@future`-annotated
variables.
[link](https://dlang.org/spec/traits.html#isFuture)
I didn't find anything
On Friday, 27 August 2021 at 02:17:21 UTC, Merlin Diavova wrote:
On Friday, 27 August 2021 at 02:10:48 UTC, Stefan Koch wrote:
On Friday, 27 August 2021 at 01:51:42 UTC, Merlin Diavova
wrote:
Hi all,
I'm Merlin, I'm just starting out in D and super excited.
My questions are:-
1. In a range
On Friday, 27 August 2021 at 01:51:42 UTC, Merlin Diavova wrote:
Hi all,
I'm Merlin, I'm just starting out in D and super excited.
My questions are:-
1. In a range pipeline how does one handle the event of a
filter range returning empty?
2. How does one unwrap a single result from a range
On Saturday, 14 August 2021 at 20:07:21 UTC, james.p.leblanc
wrote:
Good Evening/Day,
Suppose I have a number of function templates that each take
two types, say S and T.
I would like to exercise my routines over the combinations
of types:
set of all S: ( double[], float[], Complex!double[],
On Wednesday, 11 August 2021 at 06:29:40 UTC, Tejas wrote:
```d
import std;
void main()
{
int[40] staticA;
auto c = staticA[0..50];//mistake
}```
results in:
```d
core.exception.RangeError@onlineapp.d(5): Range violation
??:? _d_arrayboundsp [0x55db29a0b645]
On Friday, 30 July 2021 at 09:30:13 UTC, Mike Parker wrote:
On Friday, 30 July 2021 at 08:38:24 UTC, dangbinghoo wrote:
but, where's these switch option documented? it seems it not
appears in dmd --help or man dmd, or online document
https://dlang.org/dmd-linux.html
That's what he
On Monday, 26 July 2021 at 12:01:23 UTC, Adam D Ruppe wrote:
On Monday, 26 July 2021 at 11:43:56 UTC, workman wrote:
__FILE__[0..$]
Why do you have that [0..$] there? It is probably breaking the
__FILE__ magic.
Correct.
The compiler has to evaluate the default argument as constant
On Wednesday, 21 July 2021 at 22:51:38 UTC, hanabi1224 wrote:
Hi, I'm new to D lang and encounter some performance issues
with fiber, not sure if there's something obviously wrong with
my code.
There is your problem.
auto scheduler = new FiberScheduler;
The Fiber scheduler will spawn
On Thursday, 24 June 2021 at 07:28:56 UTC, kinke wrote:
On Thursday, 24 June 2021 at 06:50:44 UTC, Ola Fosheim Grøstad
wrote:
[...]
(I don't think I've ever seen one); with `scope c = new
Object`, you can have the compiler allocate a class *instance*
on the stack for you, but `c` is still a
On Saturday, 30 January 2021 at 23:34:50 UTC, Stefan Koch wrote:
this special version of dmd will generate a trace file which
can be read with the included printTraceHeader tool
you will want to take a look at the PhaseHist command which shows
you the compiler phase that took the most time.
On Saturday, 30 January 2021 at 22:47:39 UTC, Ahmet Sait wrote:
I'm looking for ways to figure out what parts of the code slows
down the compiler other than brute force trial.
Can I use -vtemplates switch for this?
Would -v (verbose) switch helpful in some way?
How would I know if my
On Saturday, 5 December 2020 at 02:59:58 UTC, Paul Backus wrote:
On Saturday, 5 December 2020 at 00:57:04 UTC, Stefan Koch wrote:
Hi,
today I've been dusting my SDC fork and implemented a
rudimentary version of pragma(msg).
I could pragmaStatement
as in void f()
{
pragma(msg,
Hi,
today I've been dusting my SDC fork and implemented a rudimentary
version of pragma(msg).
I could pragmaStatement
as in void f()
{
pragma(msg, typeof(f));
}
but not a declaration as in
pragma(msg, typeof(f))
without a function body.
there is a StaticAssert is in the grammar under
On Friday, 20 November 2020 at 14:08:23 UTC, jmh530 wrote:
Doing something like below fails because I don't seem to be
able to make a templated lambda that just takes types. Is the
only way to do something similar to create a separate function
to handle the condition, or is there some other
On Thursday, 22 October 2020 at 18:33:52 UTC, Ola Fosheim Grøstad
wrote:
In general, it is hard to tell if a computation is long-running
or unsolvable.
You could even say ... it's undecidable :)
On Wednesday, 30 September 2020 at 08:33:58 UTC, Frak wrote:
On Tuesday, 29 September 2020 at 18:25:03 UTC, Steven
Schveighoffer wrote:
On 9/29/20 1:08 PM, Frak wrote:
[...]
Because it's probably coming from a constraint, you probably
can't figure out the exact usage. What's more annoying
https://forum.dlang.org/post/ptgud7$16f6$1...@digitalmars.com
On Monday, 26 November 2018 at 14:02:15 UTC, Andrei Alexandrescu
wrote:
On 11/26/18 4:04 AM, Per Nordlöw wrote:
Why is there no
- __traits(isArray, T)
alongside
- __traits(isStaticArray, T) and
- __traits(isAssociativeArray, T)
On Wednesday, 15 July 2020 at 13:38:34 UTC, Cecil Ward wrote:
I recently noticed
pragma(inline, true)
which looks extremely useful. A couple of questions :
1. Is this cross-compiler compatible?
2. Can I declare a function in one module and have it _inlined_
in another module at the call
On Wednesday, 17 June 2020 at 11:50:27 UTC, Per Nordlöw wrote:
Should a range-compliant aggregate type realizing a parser be
encoded as a struct or class? In dmd `Lexer` and `Parser` are
both classes.
In general how should I reason about whether an aggregate type
should be encoded as a
On Tuesday, 9 June 2020 at 23:53:16 UTC, Q. Schroll wrote:
Is there any particular reason why std.range : enumerate is a
thing and
[...]
I don't think there is any particular reason. Other than that
might shadow an opApply.
And C++ iterators didn't have it.
On Thursday, 4 June 2020 at 14:20:45 UTC, Q. Schroll wrote:
On Thursday, 4 June 2020 at 09:03:40 UTC, Simen Kjærås wrote:
string exists(string s) {
return "__traits(compiles, { mixin(\"alias _ = "~s~";\");
})";
}
Little nitpicking, but D has many forms of string literals.
Escaping is
On Wednesday, 3 June 2020 at 09:39:34 UTC, Basile B. wrote:
On Wednesday, 3 June 2020 at 09:03:22 UTC, drathier wrote:
[...]
You can use this template:
enum Exists(alias T) = is(typeof(T));
I don't know if there's a faster way bu this technic is used,
notatbly in phobos, to workaroud
On Monday, 4 May 2020 at 17:00:21 UTC, Anonymouse wrote:
TL;DR: Is there a way to tell what module or other section of a
codebase is eating memory when compiling?
I'm keeping track of compilation memory use using zsh `time`
with some environmental variables. It typically looks like this.
On Friday, 10 April 2020 at 01:54:14 UTC, Steven Schveighoffer
wrote:
I'm building a library that uses vibe-core as an indirect
dependency. Specifically, I'm testing the library with dub test.
[...]
Those are signed unsigned mismatches when it tries to lock.
that's probably in vibe-d
On Thursday, 9 April 2020 at 20:56:59 UTC, Johan wrote:
On Thursday, 9 April 2020 at 20:42:18 UTC, Stefan Koch wrote:
Simple question, how do I keep the GC from spawning threads?
Cheers,
Stefan
https://dlang.org/changelog/2.087.0.html#gc_parallel
Thanks a lot.
Simple question, how do I keep the GC from spawning threads?
Cheers,
Stefan
On Sunday, 5 April 2020 at 22:24:27 UTC, solidstate1991 wrote:
My game engine is currently broken due to some race issue I
don't really know how to resolve.
It seems that the compiler tries to skip instructions that are
not locked with a `writeln()` or something similar. Usually I
can safely
On Sunday, 29 March 2020 at 14:04:53 UTC, TodNaz wrote:
Hello!
class A
{
...
}
class B : A
{
...
}
class C : A
{
...
}
A example1;
B example2 = new B(...);
A = example2;
auto heir = A.whoheir(); ///
The question in this code is: is it possible to track the class
inheritor? Or is
On Wednesday, 26 February 2020 at 00:50:35 UTC, Basile B. wrote:
So after reading the translation of RYU I was interested too
see if the decimalLength() function can be written to be
faster, as it cascades up to 8 CMP.
[...]
It can be made faster using binary search. Not by much though.
On Saturday, 22 February 2020 at 12:24:56 UTC, drathier wrote:
On Saturday, 22 February 2020 at 11:53:38 UTC, Dennis wrote:
On Saturday, 22 February 2020 at 11:26:19 UTC, Per Nordlöw
wrote:
Is there a dmd flag that shows the code after template
instantiations has been performed?
The -vcg-ast
On Saturday, 22 February 2020 at 11:26:19 UTC, Per Nordlöw wrote:
We're looking for a way to speed up compilation of
template-heavy code. So we are trying to find out which parts
of the code that is most costly to compile.
Is there a dmd flag that shows the code after template
instantiations
On Friday, 21 February 2020 at 09:03:26 UTC, Abby wrote:
On Monday, 17 February 2020 at 19:02:50 UTC, Stefan Koch wrote:
Sorry I just realized I never published the code.
I am going to add it to ctfeutils.
Hi Stefan,
I'm sorry to bother you, I just wanted to kindly ask if you
would upload
On Tuesday, 18 February 2020 at 03:33:21 UTC, Basile B. wrote:
On Monday, 17 February 2020 at 22:34:31 UTC, Stefan Koch wrote:
Upon seeing this I just implemented typeid(stuff).name;
https://github.com/dlang/dmd/pull/10796
With any luck this will be possible in the next release ;)
Can this
On Monday, 17 February 2020 at 18:49:55 UTC, Steven Schveighoffer
wrote:
On 2/17/20 2:28 AM, Nathan S. wrote:
What I want is something like this:
string className(in Object obj) {
return obj is null ? "null" : typeid(obj).name;
}
...except I want it to work in CTFE. What is the
On Monday, 17 February 2020 at 11:51:03 UTC, Abby wrote:
On Monday, 17 February 2020 at 11:05:46 UTC, Stefan Koch wrote:
On Monday, 17 February 2020 at 10:18:32 UTC, Abby wrote:
[...]
I have a ctfe compatible string formatter, you should be to
find it here
On Monday, 17 February 2020 at 10:18:32 UTC, Abby wrote:
Hi there guys,
I was trying to generated code during compile time. Bassicly
I'm creating a tokenizer and I would like to generated nested
switch using betterC.
[...]
I have a ctfe compatible string formatter, you should be to find
On Sunday, 16 February 2020 at 13:48:43 UTC, Виталий Фадеев wrote:
Possible mark variable for force use register ?
Example C-code:
{
register char *buf;
long pos;
register int n;
register int r;
if (!n)
return 0;
}
How to implement in D ?
Don't you
On Saturday, 2 November 2019 at 17:49:09 UTC, Luh wrote:
Hello,
When trying to pass a D function to the C callback, the
compiler says:
'Error: cannot implicitly convert expression
of type extern (C) bool delegate(const(short*) a, ulong b,
void* c) to extern (C) bool
On Wednesday, 23 October 2019 at 12:01:47 UTC, Per Nordlöw wrote:
On Wednesday, 23 October 2019 at 11:33:56 UTC, kinke wrote:
For your example, the template is inferred to be @safe, and
`-release` only elides bounds checks in @system functions
(corresponding to `-boundscheck=safeonly`). Use
On Monday, 14 October 2019 at 16:02:28 UTC, Marcel wrote:
It appears that the ABI specification only describes the
register convention for x86. Where can I find which registers
get preserved across function calls for 64-bit targets?
It's the same as c++.
On Saturday, 21 September 2019 at 13:42:09 UTC, Bogdan wrote:
Well, this seems to be working:
float[4] doSimd(float[4] values, float delta)
{
float4 v_delta = delta;
float4 v_values = __simd(XMM.ADDPS,
__simd(XMM.LODAPS, values[0]),
On Friday, 6 September 2019 at 15:09:22 UTC, Max Samukha wrote:
Consider the following two modules:
1. test.d:
module test;
import lib.a;
void main() {
foo();
}
2. lib/a.d:
module lib.a;
extern(C) void foo() {}
When compiled separately (dmd -c lib/a.d; dmd test.d a.o), the
On Thursday, 22 August 2019 at 18:10:51 UTC, jicman wrote:
Greetings!
Is there any tool out there, I searched around and didn't find
any, that would take ton of D1 code and convert it to D2?
Thanks.
josé
There is:
https://github.com/sociomantic-tsunami/d1to2fix
It might be please ask
On Saturday, 17 August 2019 at 19:43:22 UTC, Giovanni Di Maria
wrote:
Hi,
i have seen that a simple operation (in a loop) is faster than
the equivalent UDF.
The first example takes 4 seconds, the second example takes 16
seconds.
Local variables influence the speed of execution?
Thank you very
On Monday, 15 July 2019 at 13:40:29 UTC, Ben Ogles wrote:
I have written a simple function that can call another function
over integral types with random arguments:
[...]
You cannot. meta-programming and compile-time evaluation are
supposed to be deterministic,
and hence cannot take random
On Friday, 12 July 2019 at 22:46:11 UTC, Anonymouse wrote:
I'm suddenly getting segfaults when running tests on Windows.
It works fine on Linux. I reduced it to a few lines (plus a
dependency) with dustmite, but they don't really make sense[1].
Nevertheless they do trigger the segfault.
Can
On Saturday, 18 May 2019 at 16:35:44 UTC, Robert M. Münch wrote:
I want to profile my windows app which has a WinMain(). One of
the first statements in WinMain() within a try{} is:
Runtime.initialize();
But when I compile my app with -profile, it crashes on entry of
WinMain(). Looks like
On Wednesday, 15 May 2019 at 13:08:18 UTC, Bogdan wrote:
I don't have any experience with using templates. Is it
possible to create a RB tree containing structs, where the
nodes are ordered by one struct member?
```
import std.stdio;
import std.container;
enum KeyID: uint
{
KEY_A,
On Tuesday, 14 May 2019 at 08:26:41 UTC, Steven Schveighoffer
wrote:
On 5/13/19 9:39 PM, Steven Schveighoffer wrote:
Does anyone have a good answer for why this should happen, or
should I file a bug?
It's been mentioned to me that type inference is used here.
However, one could argue that
On Thursday, 2 May 2019 at 02:54:03 UTC, Andrey wrote:
Hello, I have got this code:
[...]
I want to sort array of tuples using "data" element in CTFE.
But this code give me errors:
[...]
As I understand the function "sort" sometimes can't be run at
CT because of reinterpreting cast.
On Monday, 22 April 2019 at 08:02:06 UTC, Arun Chandrasekaran
wrote:
What am I doing wrong here?
struct A
{
union B
{
int bb;
}
B b;
alias aa = B.bb;
}
void main()
{
A a = A();
// a.b.bb = 4; // works
a.aa = 4; // fails
}
https://run.dlang.io/is/kXaVy2
On Thursday, 4 April 2019 at 10:31:43 UTC, Julian wrote:
On Thursday, 4 April 2019 at 09:57:26 UTC, rikki cattermole
wrote:
If you need performance use ldc not dmd (assumed).
LLVM has many factors better code optimizes than dmd does.
Thanks! I already had dmd installed from a brief look at D
On Tuesday, 2 April 2019 at 03:15:36 UTC, Alex wrote:
Is there any way to build an alias array at compile time that
isn't too heavy in resources?
{...}
Hi Alex,
I agree that there should be a way to do that.
As soon as newCTFE is a releasable state, I'll work on that again
:)
I'd be
On Wednesday, 27 February 2019 at 17:23:21 UTC, Q. Schroll wrote:
I have a template function `fImpl` I whish to instantiate
manually using the new name `f`. Reason is simple: `f` should
not be a template, but overloading it makes it easier that way.
Nothing's more simple in D:
[...]
the
On Thursday, 14 February 2019 at 23:55:18 UTC, SimonN wrote:
std.typecons.Rebindable!(immutable A) is implemented as:
private union {
immutable(A) original;
A stripped;
}
...@trusted assignment operators...
@property inout(immutable(A)) get() @trusted pure
On Tuesday, 22 January 2019 at 16:47:45 UTC, FrankLike wrote:
On Tuesday, 22 January 2019 at 16:18:17 UTC, Adam D. Ruppe
wrote:
Use "mystring"w, notice the w after the closing quote.
Or toStringz is not work like c_str() in C++?
stringz creates a char*
but you need a wchar*
On Monday, 7 January 2019 at 13:15:44 UTC, Andre Pany wrote:
On Monday, 7 January 2019 at 13:01:57 UTC, Stefan Koch wrote:
On Monday, 7 January 2019 at 12:19:57 UTC, Andre Pany wrote:
[...]
From the function declaration seems to be the correct
thing to use here.
Have you checked that Open
On Monday, 7 January 2019 at 12:19:57 UTC, Andre Pany wrote:
Hi,
I call a C function from a dll (SO on linux). While the
following code works
fine for DMD on windows, there are strange errors for LDC on
windows. Also the equivalent code does not work for DMD/LDC on
linux.
(When calling other
On Sunday, 6 January 2019 at 21:53:31 UTC, Per Nordlöw wrote:
When converting a single integer to a string is `formatValue`
preferred over `formattedWrite` in terms of compilation and
run-time performance?
I've written my own itos function because using std.conv was too
expensive.
see
On Friday, 4 January 2019 at 11:45:24 UTC, Jacob Shtokolov wrote:
On Friday, 4 January 2019 at 10:34:07 UTC, Basile.B wrote:
Show us some code.
Here is the simple example:
https://run.dlang.io/gist/1a06dd703bea5548ee72b4713a7ce5f6
The thing I'm trying to do is to make an experimental port
On Tuesday, 18 December 2018 at 12:21:44 UTC, berni wrote:
Is there a way to check if a function is indeed executed at
compile time or not? (Other than going through the whole
executable binaries...)
I tried
static this()
{
if (__ctfe) pragma(msg,"works");
// some other stuff
}
but
On Friday, 23 November 2018 at 08:57:57 UTC, Chris Katko wrote:
Any time I see people mention the benefits of D, I see "compile
times" "compile times" "compile times" over and over.
I'm using very modest amounts of templates, for a fairly small
sized program (very early work toward a game),
On Friday, 23 November 2018 at 08:57:57 UTC, Chris Katko wrote:
Any time I see people mention the benefits of D, I see "compile
times" "compile times" "compile times" over and over.
[...]
If you can share the code privately I can use my custom profiling
build of dmd to analyze the problem.
On Thursday, 22 November 2018 at 15:38:18 UTC, Per Nordlöw wrote:
The natural way forward for D is to add static analysis in the
compiler that tracks use of possibly uninitialized classes (and
perhaps also pointers). This has been discussed many times on
the forums. The important thing with
On Wednesday, 21 November 2018 at 10:47:35 UTC, NoMoreBugs wrote:
On Monday, 19 November 2018 at 21:39:22 UTC, Adam D. Ruppe
wrote:
On Monday, 19 November 2018 at 21:23:31 UTC, Jordi Gutiérrez
Hermoso wrote:
What's the reasoning for allowing this?
The mistake is immediately obvious when you
On Friday, 2 November 2018 at 14:10:35 UTC, Richard Palme wrote:
My guess is that I have to build phobos with:
$make -f posix.mak BUILD=debug
but then what do I do next? I'm using Linux and I built
dmd+phobos manually by following this guide:
https://wiki.dlang.org/Building_under_Posix
On Wednesday, 31 October 2018 at 23:14:08 UTC, Bastiaan Veelo
wrote:
Currently, BitArray is not usable at compile time, so you
cannot do
```
enum e = BitArray([1, 1, 1, 0]);
```
This gives
/dlang/dmd/linux/bin64/../../src/phobos/std/bitmanip.d(1190):
Error: `bts` cannot be interpreted at
On Wednesday, 12 September 2018 at 10:42:08 UTC, Josphe Brigmo
wrote:
x64 gives
Privileged instruction
but x86 gives
First-chance exception: std.file.FileException "C:\": The
filename, directory name, or volume label syntax is incorrect.
at std\file.d(4573)
which is much more
On Monday, 3 September 2018 at 15:08:57 UTC, agorkvmh wrote:
On Monday, 3 September 2018 at 15:00:33 UTC, Alex wrote:
On Monday, 3 September 2018 at 14:00:23 UTC, agorkvmh wrote:
[...]
Yes. Put a pragma where you static assert for Foo(1).pos
equality with 2:
[...]
Thanks, by the way,
On Thursday, 2 August 2018 at 08:30:05 UTC, Greatsam4sure wrote:
I know D is very powerful from my little experience. What is
the idiomatic way to get prime numbers say from 1-30 without
using loops(outer and inner loop). Can map, filter, fold etc in
algorithm be use. Pls show some code with
On Tuesday, 24 July 2018 at 15:48:28 UTC, Vladimir Marchevsky
wrote:
After reading 2.081 patchnotes about improvements with binding
to cpp classes, I'm trying to test it - with simple examples
and Qt as cpp library.
My naive approach is to bind just a couple of used methods of
specific
On Thursday, 28 June 2018 at 09:26:10 UTC, Flaze07 wrote:
On Thursday, 28 June 2018 at 08:52:33 UTC, Simen Kjærås wrote:
On Thursday, 28 June 2018 at 08:36:54 UTC, Flaze07 wrote:
is there some sort of ways to turn range into tuple ? ( an
array preferably )
e.g
uint[] arr = [ 10, 20, 30 ];
On Thursday, 28 June 2018 at 08:36:54 UTC, Flaze07 wrote:
is there some sort of ways to turn range into tuple ? ( an
array preferably )
e.g
uint[] arr = [ 10, 20, 30 ];
auto tup = rangeToTup( arr );
assert( tup[ 0 ] == 10 );
assert( tup[ 1 ] == 20 );
assert( tup[ 2 ] == 30 );
I think you are
On Tuesday, 26 June 2018 at 09:14:11 UTC, Radu wrote:
Consider this https://run.dlang.io/is/HyY2qG
---
void main()
{
import std.traits;
size_t s;
pragma(msg, typeof(s).stringof);
pragma(msg, mangledName!(typeof(s)));
pragma(msg, mangledName!s);
}
---
It outputs:
---
ulong
On Sunday, 24 June 2018 at 18:21:09 UTC, rjframe wrote:
On Sun, 24 Jun 2018 14:43:09 +, Mr.Bingo wrote:
let is(CTFE == x) mean that x is a compile time constant.
CTFE(x)
converts a x to this compile time constant. Passing any
compile time
constant essentially turns the variable in to a
On Sunday, 24 June 2018 at 14:16:26 UTC, Kamil Koczurek wrote:
I recently wrote a brainfuck compiler in D, which loads the BF
source at compile time, performs some (simple) optimizations,
translates everything to D and puts it into the source code
with a mixin.
I did manage to get some
On Wednesday, 30 May 2018 at 23:07:26 UTC, Jonathan M Davis wrote:
newCTFE is taking a very different approach to CTFE, and in
theory, it will fix many of the problems that CTFE currently
has, but it's taking Stefan quite a while to get it to where it
needs to be to actually merge it.
To
On Tuesday, 12 June 2018 at 18:27:17 UTC, Dr.No wrote:
I'd like help of compiler to check this:
consider this:
int f(int n) {
m_n = n;
}
f(10); // ok
f(myTampleteFunction!(compileTimeParameter)); // ok
enum n = 10;
f(n); // I won't use this, but should also be ok
int x = 10;
f(x); // error
On Thursday, 7 June 2018 at 21:07:26 UTC, DigitalDesigns wrote:
class A;
class B
{
A a = new A();
}
auto b1 = new B();
auto b2 = new B();
assert(b1.a == b2.a)!!
I'm glad I finally found this out! This is not typical behavior
in most languages is it?
I'd expect it to be translated to
On Tuesday, 5 June 2018 at 18:00:05 UTC, Steven Schveighoffer
wrote:
No, it's definitely a bug. main is not being evaluated at
compile time. The real result of this function should be a
compile-time error -- __ctfe is a *runtime* value that is
always defined based on whether you are __ctfe
On Tuesday, 5 June 2018 at 13:27:35 UTC, Steven Schveighoffer
wrote:
On 6/5/18 6:40 AM, Simen Kjærås wrote:
On Tuesday, 5 June 2018 at 09:36:22 UTC, Gopan wrote:
void main()
{
immutable n = __ctfe ? 1 : 2;
int[n] a;
assert(a.length == n); // fails, wat
}
That's gotta be a bug -
On Saturday, 12 May 2018 at 20:23:27 UTC, boolangery wrote:
Hi,
I want to do something like that:
The user first register some type associated to a string and a
callback
registerHandler!Foo("foo", (res) {
info("message received");
});
I want the callback to be called when a json packet
On Wednesday, 2 May 2018 at 12:38:25 UTC, Jonathan M. Wilbur
wrote:
I have a method that cannot be @nogc only because it
concatenates strings for a long exception message, as seen
below.
throw new ASN1ValuePaddingException
(
"This exception was thrown
On Monday, 30 April 2018 at 12:35:06 UTC, Timoses wrote:
Hey,
reading through https://dlang.org/articles/const-faq.html and
experimenting a bit:
```
immutable int i = 3;
const(int)* p =
int* q = cast(int*)p;
assert(q == p && p == );
writeln(i); // 3
*q = 1; //
On Wednesday, 25 April 2018 at 20:31:46 UTC, solidstate1991 wrote:
On Wednesday, 25 April 2018 at 15:25:42 UTC, Stefan Koch wrote:
Pass stuff on the stack ;)
and use extern (C) functions.
Thanks! What about extern (D)? Is there a big chaos in the D
ABI under x86?
I think the D abi is not
On Tuesday, 24 April 2018 at 21:02:07 UTC, solidstate1991 wrote:
In order to make one of my own code more readable (and
hopefully to avoid a lot of compiling errors under LDC, which
don't happen in DMD for some reason), I'm planning to put my
assembly functions into separate files for each
On Wednesday, 18 April 2018 at 06:54:29 UTC, Chris Katko wrote:
I need to rotate an array by 90 degrees, or have writefln
figure that out.
I need, say:
0 4 5 6
0 0 0 0
0 0 0 0
0 0 0 0
But it's outputting:
0 0 0 0
4 0 0 0
5 0 0 0
6 0 0 0
int [4][4] data;
file.writeln(format("%(%-(%d
On Sunday, 15 April 2018 at 05:20:31 UTC, 9il wrote:
Hey,
How/where to hack DMD to generate docs for string mixed members?
struct S
{
mixin("
///
auto bar() {}
");
}
Best regards,
Ilya Yaroshenko
hmm you should be able to see docs for string mixins, if not.
try using
On Monday, 9 April 2018 at 08:27:50 UTC, Per Nordlöw wrote:
Is it possible to get the source expression sent to a lazy
function?
So that I can implement something like
show(Arg)(lazy Arg arg)
{
writeln(arg.sourceof, arg);
}
used as
show(1+2+3);
will print
1+2+3:6
Because of
On Sunday, 18 March 2018 at 12:59:06 UTC, tipdbmp wrote:
I can't read assembly but it seems to me that it doesn't:
https://godbolt.org/g/PCsnPT
I think C++'s sort can take a "function object" that can get
inlined.
Correct it does not get in-lined.
Even with -O3 it does not.
The reason is
1 - 100 of 306 matches
Mail list logo