On Monday, 6 May 2024 at 18:06:53 UTC, Julian Fondren wrote:
On Monday, 6 May 2024 at 17:55:49 UTC, user1234 wrote:
I think this just works:
```d
enum Flag : bool
{
no,
yes
}
alias AllowVancancy = Flag; // example usage
```
```d
import std.stdio : writeln;
enum Flag : bool { no,
I think this just works:
```d
enum Flag : bool
{
no,
yes
}
alias AllowVancancy = Flag; // example usage
```
Also this is completion friendly whereas Phobos version does not
permit DCD completion as it's based on opDispatch.
Compare to phobos version:
```d
template Flag(string name)
On Friday, 3 May 2024 at 15:19:13 UTC, user1234 wrote:
On Friday, 3 May 2024 at 14:59:57 UTC, BoQsc wrote:
On Friday, 3 May 2024 at 13:18:02 UTC, user1234 wrote:
[...]
So how would you update this example, what is the right index
type here to choose?
```
import std.stdio : writefln;
On Friday, 3 May 2024 at 14:59:57 UTC, BoQsc wrote:
On Friday, 3 May 2024 at 13:18:02 UTC, user1234 wrote:
On Friday, 3 May 2024 at 10:50:03 UTC, BoQsc wrote:
[...]
**You can specify the index type, just choose the right one.**
For now there's a deprecation message but after some while
On Friday, 3 May 2024 at 10:50:03 UTC, BoQsc wrote:
Why am I forced to visit this D Lang thread, why this
deprecation warning still appears in my console window in the
latest version of DMD. Does not make any sense from the
developer's perspective to show this warning and pollute the
already
On Wednesday, 1 May 2024 at 12:07:26 UTC, NotYouAgain wrote:
I want to do a C like #define on private, but I can't
ie. #define private fileprivate
// ---
module m;
alias fileprivate = private; // grr!
class myClass
{
fileprivate int n;
}
// ---
You cant. That is simply not supported.
On Thursday, 4 April 2024 at 19:56:50 UTC, Ferhat Kurtulmuş wrote:
On Thursday, 4 April 2024 at 18:14:54 UTC, BoQsc wrote:
I'm looking for more readable standard function to add a
**character** literal to a **string**.
The `~` operator is clearly not great while reading a source
code.
I'm
On Monday, 11 March 2024 at 16:51:48 UTC, Andy Valencia wrote:
On Monday, 11 March 2024 at 16:25:13 UTC, Jonathan M Davis
wrote:
...
But what exactly static means varies based on the context.
Thank you for the list! But none of those appear to apply to a
function defined in the outermost
On Saturday, 2 March 2024 at 08:41:40 UTC, Salih Dincer wrote:
SLM,
What exactly did this patch with the new update fix?
Nothing, it looks like what happened is that the issue was
wrongly referenced by a dlang.org PR
I want to share a stupid program to show you that D safety is
more complex than you might think:
```d
module test;
void test() @safe
{
int i;
int b = (*&(*&++i))++;
}
void main() @safe
{
test();
}
```
I'm not showing a deficiency of D, that program is undeniably
safe ;)
On Wednesday, 24 January 2024 at 21:30:23 UTC, user1234 wrote:
On Wednesday, 24 January 2024 at 21:12:20 UTC, atzensepp wrote:
[...]
what a bummer!
Have you tried
https://dlang.org/phobos/std_functional.html#compose ?
Well this violates the second requirement:
the composition itself
On Wednesday, 24 January 2024 at 21:12:20 UTC, atzensepp wrote:
[...]
what a bummer!
Have you tried
https://dlang.org/phobos/std_functional.html#compose ?
On Tuesday, 16 January 2024 at 13:37:59 UTC, user1234 wrote:
Implementation detail. D frontend resolves identifiers using
associative arrays (that's called symtabs in the compiler
IIRC), hence the only complexity is the scope (plus the import
decls found while going back to the module scope).
On Tuesday, 16 January 2024 at 13:19:59 UTC, Orfeo wrote:
I found myself a bit perplexed when it comes to the usage of
"nested imports" and selective imports. It seems that prominent
D programmers have varied opinions on the matter. I would love
to hear your insights and experiences on this
On Monday, 15 January 2024 at 18:34:58 UTC, H. S. Teoh wrote:
On Mon, Jan 15, 2024 at 06:16:44PM +, Bastiaan Veelo via
Digitalmars-d-learn wrote:
Hey people, I can use some help understanding why the last
line produces a compile error.
```d
import std.stdio;
struct S
{
static void
On Monday, 15 January 2024 at 18:16:44 UTC, Bastiaan Veelo wrote:
[...]
It seems to me this should just work.
Thanks!
--Bastiaan.
The two calls are not equivalent. To be equivalent you need to
set `S_foo` static too, otherwise `S_Foo` is instanciated in
`main` scope, proof:
```d
import
On Tuesday, 2 January 2024 at 11:39:12 UTC, Anonymouse wrote:
On Tuesday, 2 January 2024 at 11:05:33 UTC, user1234 wrote:
Do not use `shared` AA. Use `__gshared` + sync primitives.
`shared` AA will lead to all sort of bugs:
- https://issues.dlang.org/show_bug.cgi?id=20484#c1
-
On Monday, 1 January 2024 at 15:48:16 UTC, Anonymouse wrote:
I have a `shared string[int]` AA that I access from two
different threads. The function I spawn to start the second
thread takes the AA as an argument.
[...]
What is the common solution here? Do I add a module-level
`Object thing`
On Friday, 29 December 2023 at 17:11:49 UTC, DLearner wrote:
Compile-time:
[...]
Is there a 'foo1' that yields 1 from the snippet below?
[...]
Similarly, execution-time, is there a foo2 that wields 2 from
the snippet below:
[...]
**compile-tome**
```d
void main() {
import std.stdio;
On Saturday, 2 December 2023 at 16:17:08 UTC, user1234 wrote:
On Saturday, 2 December 2023 at 15:30:39 UTC, zoujiaqing wrote:
[...]
sign is binary, you have to use the toHexString utility :
```d
import std.stdio;
import std.digest.sha;
void main()
{
SHA256 sha256;
sha256.start();
On Saturday, 2 December 2023 at 15:30:39 UTC, zoujiaqing wrote:
```D
import std.stdio;
import std.digest.sha;
void main()
{
SHA256 sha256;
sha256.start();
string appKey =
"1";
ubyte[1024] data =
On Saturday, 2 December 2023 at 13:16:26 UTC, Johannes
Miesenhardt wrote:
Hello,
[...]
I see the way why it doesn't work, but I think it should.
Considering that
`version (Test) {} else {`
works without any issue but looks very ugly.
Can somebody explain if this is an intended decision or
On Sunday, 5 November 2023 at 18:36:40 UTC, Ctn-Dev wrote:
I wrote this earlier:
[...]
if runs when both "One" and "Two" are in the given array as
intended, but its conditional statement looks verbose. Is there
a more concise way of getting the same result?
Yes, assuming you accept to drop
On Wednesday, 11 October 2023 at 13:36:16 UTC, Paul wrote:
On Wednesday, 11 October 2023 at 12:54:53 UTC, user1234 wrote:
`extern(C)` on module level functions affect the mangling and
the calling convention.
- Mangling is used by the linker to link symbols between
objects.
- Calling
On Wednesday, 11 October 2023 at 12:36:58 UTC, Paul wrote:
What does the extern (c) attribute(?) do?
Does it tell the compiler/linker to build the function like a C
compiler would build a C function? If so what does that mean?
Does it tell the compiler/linker to let C functions know it
exists?
On Thursday, 5 October 2023 at 22:24:06 UTC, mw wrote:
On Thursday, 5 October 2023 at 21:41:38 UTC, cc wrote:
If you have `T info`, T.tupleof[n] will always match up with
info.tupleof[n]. You can think of `info.tupleof[n]` as being
rewritten by the compiler in-place as
On Thursday, 5 October 2023 at 20:42:26 UTC, mw wrote:
On Thursday, 5 October 2023 at 20:07:38 UTC, user1234 wrote:
No. Sorry.
Generally compile time code cannot interact with the system.
To be evaluable at compile time code has to be strongly pure,
that is not the case of the function you
On Thursday, 5 October 2023 at 18:40:36 UTC, mw wrote:
On Saturday, 24 November 2018 at 15:21:57 UTC, Anonymouse wrote:
On Saturday, 24 November 2018 at 08:44:19 UTC, Domain wrote:
I have a package named command, and many modules inside it,
such as command.build, command.pack, command.help...
On Friday, 22 September 2023 at 04:33:44 UTC, Vitaliy Fadeev
wrote:
On Friday, 22 September 2023 at 04:24:19 UTC, Vitaliy Fadeev
wrote:
...
Skip this thread. I see solution.
How to delete missed posts on this forum ?
It's there forever, you have to live with that error ;)
See
On Thursday, 21 September 2023 at 16:28:25 UTC, Nick Treleaven
wrote:
(Untested)
There might be a `need this` error
On Sunday, 17 September 2023 at 17:15:34 UTC, Timofey wrote:
I`ve just started learning d and have a question.
What should I write to set dinamyc rectangular array length in
both dimentions?
For example, I have declareted an array:
```d
int[][] matrix;
```
and want set it as n*n matrix.
On Monday, 11 September 2023 at 22:08:54 UTC, Christian Köstlin
wrote:
Just three remarks:
First I would recommend to use `std.process : execute` instead
of
`pipeProcess` in this usecase, as this will wait properly for
the process to exit and it also will collect its output.
Second its
On Saturday, 9 September 2023 at 15:44:44 UTC, Vino wrote:
Hi All,
Request your help on how to convert the output of
std.process.pipeProcess to hash string
```
auto test(in Redirect redirect=Redirect.stdout |
Redirect.stderr) {
import std.process;
import std.digest.crc;
On Monday, 4 September 2023 at 09:41:54 UTC, BoQsc wrote:
I've seen everyone using **datatype**`.sizeof` property.
https://dlang.org/spec/property.html#sizeof
It's great, but I wonder if it differ in any way from the
standard C function `sizeof()`.
On Friday, 25 August 2023 at 21:00:08 UTC, Guillaume Piolat wrote:
The idea is to deliberately mark @system functions that need
special scrutiny to use, regardless of their memory-safety.
Function that would typically be named `assumeXXX`.
```d
class MyEncodedThing
{
Encoding encoding;
On Thursday, 23 March 2023 at 14:17:25 UTC, user1234 wrote:
not exactly thing goal yet. The doc example you have put a link
for is different, the struct with alias this a redefinition of
the "alias this"'ed thing, that just cant work in what you ask
in the first post.
omg, let's rewrite
On Thursday, 23 March 2023 at 14:05:07 UTC, Alexander Zhirov
wrote:
On Thursday, 23 March 2023 at 13:38:51 UTC, Alexander Zhirov
wrote:
Is it possible to convert such records inside the structure to
the assigned type?
```d
struct MyVal
{
string value;
// Here it would be possible to
On Monday, 13 March 2023 at 14:17:57 UTC, jmh530 wrote:
I was looking at [1] for ways to prevent the compiler from
optimizing away code when trying to benchmark.
It has the following C++ code as a simpler version:
```
inline BENCHMARK_ALWAYS_INLINE void DoNotOptimize(Tp& value) {
asm
On Wednesday, 8 March 2023 at 12:46:53 UTC, Hipreme wrote:
On Wednesday, 8 March 2023 at 10:49:32 UTC, Markus wrote:
Hi, sorry for the broad and vague question. I have read in
some reddit post about benchmarks, that some code didn't use
the final keyword on methods in a sense that final would
On Friday, 24 February 2023 at 12:00:41 UTC, Elfstone wrote:
Seems like the same bug is still there after ten years.
```d
struct Bar
{
@("hello") int t;
}
static bool hasAttribute(alias F, T)()
{
bool result = false;
On Friday, 17 February 2023 at 17:03:34 UTC, ron77 wrote:
Hello, I succeeded in converting an ELIZA code from C to D, and
here are the results. although I'm sure there are better ways
to code it or to convert it...
[...]
Among the things to do the first is to drop C-style strings, so
that
On Sunday, 5 February 2023 at 11:52:01 UTC, Alexander Zhirov
wrote:
On Saturday, 4 February 2023 at 15:56:41 UTC, Richard (Rikki)
Andrew Cattermole wrote:
[...]
I don't understand why the compiler doesn't see the library.
```sh
User@WIN-D3SHRBHN7F6 MINGW64 /home/user/pxe-restore/source
# ls
On Saturday, 17 December 2022 at 02:42:22 UTC, Paul wrote:
I see code like this from time to time. Are the leading
underscores significant, in general, in the D language? Is it
just programmer preference? Is it a coding practice, in
general, that is common...even outside of D? Thanks for
On Thursday, 20 October 2022 at 16:34:34 UTC, user1234 wrote:
On Thursday, 20 October 2022 at 14:03:10 UTC, tchaloupka wrote:
Hi,
I've found strange behavior where:
[...]
Shouldn't it at least protest that objects can't be passed to
the function as they aren't copyable?
it's clearly a
On Thursday, 20 October 2022 at 14:03:10 UTC, tchaloupka wrote:
Hi,
I've found strange behavior where:
[...]
Shouldn't it at least protest that objects can't be passed to
the function as they aren't copyable?
it's clearly a compiler bug to me. Something is not checked when
the call is
On Saturday, 15 October 2022 at 01:48:15 UTC, kdevel wrote:
Is this consistent?
I think all the compilers should error on expressions like
`Type.nonStaticMethod` and instead there should be a new
__traits dedicated to that, especially because `this` is not a
formal parameter.
On Wednesday, 12 October 2022 at 02:15:55 UTC, Steven
Schveighoffer wrote:
Porting some C code to D
This results in an error:
```d
int x;
while(!(x = 5)) { break; }
```
Error is: assignment cannot be used as a condition, perhaps
`==` was meant?
...
I think D should relax the restriction
On Monday, 10 October 2022 at 06:30:05 UTC, Arun wrote:
Stumbled upon this question on HN
https://news.ycombinator.com/item?id=33142751#33147401
Can I write template A and then apply it to itself to get
template B and then apply that onto template C to get template
D.
Does anyone have an
On Saturday, 8 October 2022 at 23:06:13 UTC, Anonymouse wrote:
I have some nested templated code that takes function pointers.
In many cases I pass it functions of identical signatures,
except some are `@safe` and others are `@system`. In those
cases the templates end up getting instantiated
On Friday, 7 October 2022 at 04:40:34 UTC, mw wrote:
Hi,
I have a LDC (1.30.0) built binary on Ubuntu 18.04.5 LTS
x86_64, the program core dumps somewhere, so I want to debug
it. However under gdb, the program fails as soon as I start it:
[...]
Try the non-stop mode maybe :
On Thursday, 22 September 2022 at 10:53:32 UTC, Salih Dincer
wrote:
Is there a more accurate way to delete the '\0' characters at
the end of the string? I tried functions in this module:
https://dlang.org/phobos/std_string.html
```d
auto foo(string s)
{
string r;
foreach(c; s)
{
On Friday, 9 September 2022 at 17:35:44 UTC, Dennis wrote:
On Friday, 9 September 2022 at 16:41:54 UTC, Andrey Zherikov
wrote:
What's about new `compileOutput` trait that returns compiler
output?
```d
static assert(__traits(compileOutput, { }) ==
"message");
```
As a compiler dev, that
On Tuesday, 16 August 2022 at 08:25:18 UTC, Diego wrote:
Hello everyone,
I'm a Java programmer at work but i'm learning D for pleasure.
I'm reading _The D Programming Language by Ali Çehreli_.
I noticed that DMD creates very huge executable, for example an
empty program:
```
empty.d:
On Thursday, 4 August 2022 at 13:18:40 UTC, kdevel wrote:
At DConf '22 day 3 Robert Schadek presented at around 07:22:00
in the YT video the function `splitIds`. Given an HTML page
from bugzilla containing a list of issues `splitIds` aims at
extracting all bug-ids referenced within a specific
On Thursday, 28 July 2022 at 06:12:49 UTC, Alexander Zhirov wrote:
On Thursday, 28 July 2022 at 06:01:17 UTC, Alexander Zhirov
> x86- 32-bit X86: Pentium-Pro and above
I also tried with `i586` and `pentium` - the result is the same.
Pentium Pro and above means at least i686. i586 is
On Thursday, 28 July 2022 at 07:16:13 UTC, user1234 wrote:
On Thursday, 28 July 2022 at 06:12:49 UTC, Alexander Zhirov
wrote:
[...]
Pentium Pro and above means at least i686. i586 is Pentium1
which is less featured.
That means that you cant do much, however you can try to tune
the i686
On Tuesday, 12 July 2022 at 19:55:46 UTC, ag0aep6g wrote:
On Tuesday, 12 July 2022 at 19:02:01 UTC, user1234 wrote:
On Tuesday, 12 July 2022 at 16:40:38 UTC, H. S. Teoh wrote:
[...]
Do not rely on this, however;
Absolutely. I'd like to add: especially as default parameter
value that's an
On Tuesday, 12 July 2022 at 16:40:38 UTC, H. S. Teoh wrote:
On Tue, Jul 12, 2022 at 04:27:44PM +, Antonio via
Digitalmars-d-learn wrote:
It works
```d
void main()
{
assert(null=="");
}
```
why?
Because an empty string is, by default, represented by an empty
slice of the null
On Friday, 1 July 2022 at 13:53:28 UTC, Antonio wrote:
On Friday, 1 July 2022 at 13:48:25 UTC, Antonio wrote:
-Why?
I realized Json is an struct (not an object)... and I supose,
it is managing null asignation manually (as a way to build
Json(null)).
-Whats the correct whay to test if
On Tuesday, 14 June 2022 at 13:39:12 UTC, Andrey Zherikov wrote:
I have [pretty simple code in my
library](https://github.com/andrey-
[Line (2)
produces](https://github.com/andrey-zherikov/argparse/runs/6880350900?check_suite_focus=true#step:5:12) `undefined reference to
On Monday, 13 June 2022 at 07:38:54 UTC, user1234 wrote:
On Thursday, 9 June 2022 at 23:50:10 UTC, user1234 wrote:
On Thursday, 9 June 2022 at 21:20:27 UTC, JG wrote:
[...]
No, for now there if there are other ways they are as hacky as
yours.
The compiler usually uses a global counter to
On Thursday, 9 June 2022 at 23:50:10 UTC, user1234 wrote:
On Thursday, 9 June 2022 at 21:20:27 UTC, JG wrote:
[...]
No, for now there if there are other ways they are as hacky as
yours.
The compiler usually uses a global counter to generate
temporaries.
There's [been attempts] to expose
On Thursday, 9 June 2022 at 21:20:27 UTC, JG wrote:
Hi,
As an experiment I have implemented the following kind of
pattern matching
(by parsing the part of the string before '=').
```d
struct S {
int x;
int y;
}
struct T {
int w;
S s;
}
void main()
{
mixin(matchAssign(q{auto
On Friday, 27 May 2022 at 13:40:25 UTC, Alexander Zhirov wrote:
I'm trying to compile a file that weighs 3 kilobytes. I'm also
linking a self-written dynamic library. I don't understand why
the resulting executable file is so huge? After all, all
libraries are present:
I'd take a look with
On Friday, 27 May 2022 at 09:41:32 UTC, user1234 wrote:
[...]
on a side note that's funny how dmd manages to systematically
print the less interesting message in both case.
They are actually correct, I dont know why at some point I
thought there was a problem. For the float one it's
On Friday, 27 May 2022 at 08:39:08 UTC, vit wrote:
Hello, I have this problem:
```d
static int i;
void bar(T)(){
static if(is(T == int))
(()@system => 1)();
static if(is(T == float))
i = 42;
}
void foo(T)(){
bar!T();
}
void main()@safe pure{
On Wednesday, 25 May 2022 at 06:04:10 UTC, frame wrote:
On Wednesday, 25 May 2022 at 05:56:28 UTC, Steven Schveighoffer
wrote:
It's a case where the compiler can't divine what you were
thinking when you wrote that code ;)
I see not in all cases but in mine. If the compiler sees the
On Monday, 23 May 2022 at 08:53:27 UTC, user1234 wrote:
On Monday, 23 May 2022 at 08:52:12 UTC, vit wrote:
On Monday, 23 May 2022 at 08:34:21 UTC, Chris Katko wrote:
D
struct pair
{
float x,y;
}
[...]
This work too:
```d
myFunction(taco, p.tupleof, burrito);
```
and you can pass a
On Monday, 23 May 2022 at 08:52:12 UTC, vit wrote:
On Monday, 23 May 2022 at 08:34:21 UTC, Chris Katko wrote:
D
struct pair
{
float x,y;
}
[...]
This work too:
```d
myFunction(taco, p.tupleof, burrito);
```
and you can pass a std.typecons.Tuple as well, it will expand x y
On Thursday, 19 May 2022 at 10:15:32 UTC, Chris Katko wrote:
given
```D
struct COLOR
{
float r, g, b, a; // a is alpha (opposite of transparency)
}
auto red = COLOR(1,0,0,1);
auto green = COLOR(0,1,0,1);
auto blue = COLOR(0,0,1,1);
auto white = COLOR(1,1,1,1);
//etc
```
is there a way to
On Tuesday, 3 May 2022 at 17:21:47 UTC, JG wrote:
Hi,
The specification of string literals has either some errors or
I don't understand what is meant by a Character.
[...]
Which to me means that e.g.
r"""
should be a WysiwygString, which the compiler thinks is not
(not surprisingly).
Am I
On Wednesday, 27 April 2022 at 17:22:14 UTC, vit wrote:
This work for types but not for attributes like `scope`,
`return` and `auto ref`.
Oh sorry... auto ref... I totally forgot [this old bug]
[this old bug]: https://issues.dlang.org/show_bug.cgi?id=8204
On Wednesday, 27 April 2022 at 15:23:26 UTC, vit wrote:
Hi, is it possible to get address of generic function instance
for specified arguments without calling the function?
Example:
```d
auto foo(alias fn, Args...)(auto ref Args args){
///return function/delegate type of `fn` for
On Tuesday, 26 April 2022 at 21:33:43 UTC, Chris Katko wrote:
I swear I asked something like this before years ago but it
doesn't show up in my previous forum posts.
I'm looking for a construct that mimics using(var)/with(var)
```D
bitmap* b;
draw_with(b)
{
draw_pixel(red, 16, 16);
On Sunday, 24 April 2022 at 15:13:15 UTC, Alain De Vos wrote:
I'm currenlty experimenting about binding to C.
I have :
C-library:
mylib.h:
```
void libprintme(char *s);
```
mylib.c:
```
#include
#include "mylib.h"
void libprintme(char *s){printf("%s",s);}
```
[...]
Can this procedure be
On Monday, 18 April 2022 at 10:26:16 UTC, HuskyNator wrote:
On a sidenote, I'm surprised D did not choose 0 as the default
floating value. Doesn't almost every language do this? I
understand the thinking behind it, but when the type one uses
in a template influences the behavior of the code,
On Sunday, 17 April 2022 at 11:16:25 UTC, HuskyNator wrote:
I recently found out there is [support for vector
extensions](https://dlang.org/spec/simd.html)
But I have found I don't really understand how to use it, not
even mentioning the more complex stuff. I couldn't find any
good examples
On Monday, 11 April 2022 at 09:11:06 UTC, Salih Dincer wrote:
How is this possible? Why is it compiled? Don't the same names
in the same scope conflict?
```d
int function(int) square;
void main()
{
square = (int a) => a * a;
int square = 5.square;
assert(square == 25);
}
```
Thanks,
On Sunday, 10 April 2022 at 23:05:24 UTC, norm wrote:
Hi All,
I am clearly misunderstanding something fundamental, and
probably obvious :D
Reading some of the discussions on __metadata I was wondering
if someone could explain why a immutable reference counting
type is needed. By definition
On Saturday, 2 April 2022 at 21:57:02 UTC, Marcone wrote:
Where I download Digital Mars C Preprocessor sppn.exe? I need
it to use ImportC
it's part of the [DMC] toolchain.
[DMC]:
http://ftp.digitalmars.com/Digital_Mars_C++/Patch/dm857c.zip
On Saturday, 19 March 2022 at 05:25:01 UTC, Era Scarecrow wrote:
On Saturday, 19 March 2022 at 00:16:48 UTC, user1234 wrote:
That crashes because of the creation of `Bar b` member, which
itself has a Bar b member, which itself...
Mhmm... So There's Foo with Bar b, which has Bar b which has
On Saturday, 19 March 2022 at 00:05:54 UTC, Salih Dincer wrote:
Greetings to all...
There are nested classes as below. But beware, there's also
inheritance, extra! If you construct ```Bar b``` from main(),
it's okay. But if declare the constructor in Foo(), the program
crashes with a
On Wednesday, 16 March 2022 at 14:42:02 UTC, Era Scarecrow wrote:
On Wednesday, 16 March 2022 at 11:27:20 UTC, user1234 wrote:
assuming the c library takes by reference
My experience all arrays are effectively just pointers
I meant the function that takes the Test2 as parameter, but to be
On Wednesday, 16 March 2022 at 07:27:06 UTC, test wrote:
```c
struct Test {
int32_t a;
}
struct Test2 {
int32_t a;
Test arr[];
}
```
I need static const init Test2, then pass it to c library
late(third library, can not change the type def).
I am not sure how to do it in D.
On Friday, 18 February 2022 at 23:46:51 UTC, forkit wrote:
On Friday, 18 February 2022 at 16:45:24 UTC, Ali Çehreli wrote:
...
I think that syntax will be obviated when D will have named
arguments.
Ali
Huh? D doesn't have named arguments, already?
That's an important component for
On Wednesday, 9 February 2022 at 10:25:34 UTC, bauss wrote:
Is it guaranteed that the value is initialized at compiletime
however?
yes, D guarentees this at 100%.
On Wednesday, 9 February 2022 at 10:29:03 UTC, ag0aep6g wrote:
Try to think of a more efficient way of storing the information.
I cant agree more. The problem of OP is not dynamic arrays, it's
that he uses an inadequate data structure.
On Sunday, 12 December 2021 at 11:57:43 UTC, vit wrote:
Hello, why does this code fail to compile?
```d
struct Foo(T){
this(Rhs, this This)(scope Rhs rhs){
}
this(ref scope typeof(this) rhs){
}
}
struct Bar{
Foo!int foo;
}
void main(){
}
```
error: Segmentation
On Sunday, 28 November 2021 at 16:44:38 UTC, russhy wrote:
On Sunday, 28 November 2021 at 14:53:17 UTC, user1234 wrote:
...
there is a plugin to demangle things automatically
https://github.com/ANtlord/gdb-ddemangle
That's off-topic. The point here is that you can (unfortunately)
On Saturday, 27 November 2021 at 14:17:11 UTC, Eduard Staniloiu
wrote:
Hello,
I'm trying to use `gdb` to debug D binaries, but I'm having
trouble accessing the methods of a struct or class. It seems
that `gdb` doesn't see them.
[...]
Looking forward to your answers,
Edi
[0] -
On Saturday, 27 November 2021 at 11:15:45 UTC, Igor wrote:
Two years ago there was a [Google Summer of Code
project](https://forum.dlang.org/thread/izaufklyvmktnwsrm...@forum.dlang.org) to implement these primitives in pure D for various reason. It was concluded the project isn't viable and was
On Sunday, 14 November 2021 at 05:12:58 UTC, Andrey Zherikov
wrote:
Here is my code:
[...]
`W()` (2) works as expected but is it possible to achieve the
same without parenthesis so `getAttributes` trait returns
`tuple(L("app.d", 16LU))` for (1)?
No, without parens this is really the function
On Sunday, 31 October 2021 at 17:51:45 UTC, data pulverizer wrote:
On Sunday, 31 October 2021 at 17:35:35 UTC, Ali Çehreli wrote:
On 10/31/21 7:07 AM, Salih Dincer wrote:
> [...]
because I
> [...]
Makes sense because e.g. the following works:
struct S {
auto i = 42;
}
I bet the problem
On Friday, 22 October 2021 at 05:54:21 UTC, Kirill wrote:
I am not a compiler expert, but I genuinely would like to know
why we have Dmain.
I've been looking at the generated assembly code recently and
noticed the _Dmain function. I didn't notice it before. Then
there is main, where Dmain is
On Sunday, 17 October 2021 at 21:00:19 UTC, Steven Schveighoffer
wrote:
On 10/16/21 6:47 PM, solidstate1991 wrote:
When I make this call
```
format(" %3.3f"w, avgFPS);
```
my program immediately crashes with an access violation error.
The debugger out is different between x86 and x86-64.
On Wednesday, 22 September 2021 at 15:27:23 UTC, wjoe wrote:
Is there a convenient way to exclude it from coverage ?
Because adjusting the -cov=xx percentage is kind of annoying
and may omit other things as well.
Do you care and if yes how do you handle it ?
You have several options
1.
On Monday, 13 September 2021 at 18:06:42 UTC, NonNull wrote:
On Monday, 13 September 2021 at 14:42:42 UTC, jfondren wrote:
On Monday, 13 September 2021 at 14:33:03 UTC, user1234 wrote:
- condition al expression ` cond ? exp : exp `
And many other boolean operators, unary !, binary && and ||
On Monday, 13 September 2021 at 17:54:43 UTC, eugene wrote:
On Monday, 13 September 2021 at 17:40:41 UTC, user1234 wrote:
The problems seems to lies in `newSignal()` which "would" not
allocate using the GC.
final Signal newSignal(int signum) {
Signal sg = new Signal(signum);
On Monday, 13 September 2021 at 17:18:30 UTC, eugene wrote:
[...]
At first glance and given the fact that some code necessary to
diagnose the problem accurately is missing:
`new Stopper` allocates using the GC. it's then a "GC range",
it's content will be scanned and handled by the GC,
On Monday, 13 September 2021 at 17:40:41 UTC, user1234 wrote:
On Monday, 13 September 2021 at 17:18:30 UTC, eugene wrote:
[...]
At first glance and given the fact that some code necessary to
diagnose the problem accurately is missing:
`new Stopper` allocates using the GC. it's then a "GC
1 - 100 of 227 matches
Mail list logo