On Tuesday, 12 December 2017 at 07:33:47 UTC, Ivan Trombley wrote:
Is there some way that I can make this array immutable?
static float[256] ga = void;
static foreach (i; 0 .. 256)
ga[i] = (i / 255.0f) ^^ (1 / 2.2f);
Check
https://dlang.org/phobos/std_exception.html#assumeUnique
On Tuesday, 20 February 2018 at 16:01:11 UTC, Smaehtin wrote:
I'm trying to understand why the following doesn't work:
import std.stdio;
import std.variant;
void main()
{
Algebraic!(string, int) test = "Test";
test.tryVisit!(
(ref string s) { s = "Why does this not work?"; }
I have this:
enum Type { a };
struct S(Type t = Type.a)
{
this(Type)(Type t)
{
import std.stdio;
writeln("ctor called.");
}
}
void main()
{
auto x = S!(Type.a)(Type.a);
void* y = &x;
auto z = (cast(S!(Type.a)) y);
}
Surprisingly the cast will actually c
On Tuesday, 27 February 2018 at 20:51:25 UTC, ag0aep6g wrote:
On 02/27/2018 09:30 PM, Radu wrote:
enum Type { a };
struct S(Type t = Type.a)
{
this(Type)(Type t)
{
import std.stdio;
writeln("ctor called.");
}
}
void main()
{
auto x = S!(Type.a)(Type.a);
On Tuesday, 27 February 2018 at 21:04:59 UTC, ag0aep6g wrote:
On 02/27/2018 09:59 PM, Radu wrote:
On Tuesday, 27 February 2018 at 20:51:25 UTC, ag0aep6g wrote:
On 02/27/2018 09:30 PM, Radu wrote:
[...]
[...]
[...]
So the bug is that somehow the templated version makes it so
there is an impl
On Tuesday, 13 March 2018 at 06:14:49 UTC, psychoticRabbit wrote:
On Tuesday, 13 March 2018 at 06:01:43 UTC, ketmar wrote:
ah, yes, sorry: i completely forgot that C++ was invented
after c# and java. mea maxima culpa!
My point was, that the 2 most widely used and popular languages
on the pl
On Tuesday, 13 March 2018 at 08:05:43 UTC, psychoticRabbit wrote:
On Tuesday, 13 March 2018 at 06:03:11 UTC, Mike Parker wrote:
I think it's a great feature and I use it frequently. It's
allows more flexibility in class design. Without it, we'd need
another protection attribute to enable the
On Friday, 16 March 2018 at 07:00:36 UTC, ashit axar wrote:
On Thursday, 15 March 2018 at 17:30:48 UTC, Seb wrote:
They generate the same assembly: https://godbolt.org/g/4ohTJx
import std.stdio;
void main()
{
writeln("hello");
}
this generate error for dmd there.
`writeln` is not sup
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.
add "-O3" also to the compiler switches.
On Tuesday, 24 April 2018 at 00:46:39 UTC, Byron Heads wrote:
On Friday, 20 April 2018 at 20:52:17 UTC, Byron Moxie wrote:
On Friday, 20 April 2018 at 20:46:20 UTC, Steven Schveighoffer
wrote:
On 4/20/18 2:58 PM, Byron Moxie wrote:
[...]
It sounds like the problems may be due to Win32 and no
On Tuesday, 24 April 2018 at 13:36:48 UTC, Steven Schveighoffer
wrote:
On 4/24/18 5:11 AM, bauss wrote:
On Tuesday, 24 April 2018 at 07:58:01 UTC, Radu wrote:
On Tuesday, 24 April 2018 at 00:46:39 UTC, Byron Heads wrote:
[...]
This is not a fiber issue but a more memory management issue.
Yo
On Tuesday, 24 April 2018 at 16:05:48 UTC, Steven Schveighoffer
wrote:
On 4/24/18 10:16 AM, Radu wrote:
On Tuesday, 24 April 2018 at 13:36:48 UTC, Steven
Schveighoffer wrote:
On 4/24/18 5:11 AM, bauss wrote:
On Tuesday, 24 April 2018 at 07:58:01 UTC, Radu wrote:
On Tuesday, 24 April 2018 at 00
On Thursday, 10 May 2018 at 03:23:50 UTC, Mike Franklin wrote:
Consider the following code:
---
struct S
{
// intentionally not `static`
struct SS
{
int y() { return x; } // Error: need `this` for `x` of
type `int`
}
int x;
SS ss;
}
void main()
{
S s;
On Friday, 15 July 2016 at 14:09:40 UTC, Claude wrote:
Hello,
I would like to cross-compile a D program from a x86 machine to
an ARM target.
I work on GNU/Linux Ubuntu 64-bit.
I have an ARM gcc toolchain, which I can use to make programs
on an ARM Cortex-A9 architecture running a Linux kerne
On Thursday, 8 December 2016 at 11:09:12 UTC, ketmar wrote:
what can be done, tho, is article (or series of articles)
describing what exactly druntime is, how it is compared to libc
and libc++, why it doesn't hurt at all, how to do "bare metal"
with custom runtime, why GC is handy (and how to l
I'm puzzled by the way destroy works when passed a pointer to a
struct, observe:
--code.d--
int i;
struct C
{
this(ref int i)
{
++i;
ii = &i;
}
~this()
{
--(*i
On Saturday, 25 February 2017 at 08:36:02 UTC, Ali Çehreli wrote:
On 02/25/2017 12:17 AM, Radu wrote:
> destroy(cc) -> does c = C.init
> destroy(*cc); -> calls the C dtor
>
> Is this by design? If so - how can I destroy and get the dtor
called
> without dereferencing the pointer?
It's by design
On Saturday, 25 February 2017 at 13:14:24 UTC, Moritz Maxeiner
wrote:
On Saturday, 25 February 2017 at 10:44:07 UTC, Radu wrote:
On Saturday, 25 February 2017 at 08:36:02 UTC, Ali Çehreli
wrote:
On 02/25/2017 12:17 AM, Radu wrote:
> destroy(cc) -> does c = C.init
> destroy(*cc); -> calls the C
On Saturday, 25 February 2017 at 13:18:21 UTC, Moritz Maxeiner
wrote:
On Saturday, 25 February 2017 at 13:14:24 UTC, Moritz Maxeiner
wrote:
---
struct A {}
auto a = cast (A*) malloc(A.sizeof); // Allocate
emplace(a, 42); // Construct
destroy(a); //
On Saturday, 25 February 2017 at 16:39:18 UTC, Moritz Maxeiner
wrote:
On Saturday, 25 February 2017 at 15:13:27 UTC, Radu wrote:
[...]
Thanks for the example.
[...]
Hm, that's an issue you'd best take up to the bugtracker, I
think. Maybe there's a way around that, but I don't know.
[..
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
m
_D9onlineapp4mainFZ1sm
---
I'm looking for a way to g
On Tuesday, 26 June 2018 at 09:24:15 UTC, Stefan Koch wrote:
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)));
On Tuesday, 26 June 2018 at 10:19:44 UTC, Jonathan M Davis wrote:
On Tuesday, June 26, 2018 09:47:44 Radu via Digitalmars-d-learn
wrote:
On Tuesday, 26 June 2018 at 09:24:15 UTC, Stefan Koch wrote:
> On Tuesday, 26 June 2018 at 09:14:11 UTC, Radu wrote:
>> Consider this https://run.dl
On Tuesday, 26 June 2018 at 12:19:16 UTC, Jonathan M Davis wrote:
On Tuesday, June 26, 2018 11:28:11 Radu via Digitalmars-d-learn
wrote:
> [...]
Ha! :) yeah I was pretty sure this will not work.
I'm looking to generate some custom wrappers and knowing when
something is really `si
On Friday, 29 June 2018 at 09:44:27 UTC, Anton Fediushin wrote:
Almost forgot, there are two timers which call this function
for two different streams.
Value of `metaint` is 16000, which means that only 16KB of
memory are allocated for the `buffer`, then it reads another
byte which contains l
On Friday, 13 July 2018 at 10:21:54 UTC, Michael wrote:
Hello,
I am nesting some function calls, and I'm pretty used to making
use of D's Uniform Function Call Syntax, but I'm getting an
error if I try to convert this line:
createSet(createVector(langSize, index)).length;
which works, int
On Friday, 13 July 2018 at 11:12:47 UTC, Michael wrote:
On Friday, 13 July 2018 at 10:52:54 UTC, Radu wrote:
On Friday, 13 July 2018 at 10:21:54 UTC, Michael wrote:
[...]
Do you try to call member functions? UFCS only works with free
functions, meaning declared at module level.
https://dla
On Thursday, 19 July 2018 at 11:35:00 UTC, Seb wrote:
On Thursday, 19 July 2018 at 10:27:36 UTC, Zheng (Vic) Luo
wrote:
Current implementation of d-runtime relies on a lot of symbols
from libc, librt, libpthread, which makes it hard to create a
minimal runtime used for embedded devices. Althoug
On Thursday, 19 July 2018 at 18:16:17 UTC, kinke wrote:
On Thursday, 19 July 2018 at 12:44:30 UTC, Radu wrote:
[...]
Removing some superfluous explicit druntime dependencies from
Phobos would be a start. Your (nice) example compiles fine with
this 4-lines Phobos hack:
[...]
Was able to g
On Thursday, 2 August 2018 at 10:47:33 UTC, Ky-Anh Huynh wrote:
Hi,
can I build my program on OpenWrt? I haven't found any
resources on internet maybe I'm missing something.
Thanks a lot.
LDC 1.10+ should have pretty good support for OpenWRT uClibc for
ARM, and some support for uClibc MIPS
On Thursday, 2 August 2018 at 10:47:33 UTC, Ky-Anh Huynh wrote:
Hi,
can I build my program on OpenWrt? I haven't found any
resources on internet maybe I'm missing something.
Thanks a lot.
A status report on what works and how to get LDC to compile for
OpenWRT uClibc ARM:
https://github.co
On Friday, 10 August 2018 at 13:05:24 UTC, Kagamin wrote:
Mixim template can only introduce declarations, not statements,
a workaround is a lambda called in place.
mixin template test(A...){
__gshared a = A;
int dummy = (){ a++; return 0; }();
}
extern(C) void main(){
m
On Friday, 24 August 2018 at 16:30:56 UTC, John Burton wrote:
On Friday, 24 August 2018 at 15:26:30 UTC, kinke wrote:
On Friday, 24 August 2018 at 13:10:40 UTC, John Burton wrote:
Is in the subject. Are there any cross compilers that will
run on a linux system but compile D code using Win32 int
On Saturday, 25 August 2018 at 20:37:04 UTC, Everlast wrote:
On Saturday, 25 August 2018 at 20:28:55 UTC, Chris M. wrote:
On Saturday, 25 August 2018 at 20:17:35 UTC, AN wrote:
I downloaded the script and made it executable. I also have
dub on `/usr/bin/dub` . The example just stalls with no
o
On Thursday, 30 August 2018 at 13:36:58 UTC, Per Nordlöw wrote:
Recently the benchmark
https://github.com/nordlow/phobos-next/tree/master/benchmarks/containers/dub.sdl
[...]
There is a way to specify the linker to be used
```
-linker= - Linker to use
```
On Wednesday, 26 September 2018 at 03:46:21 UTC, dangbinghoo
wrote:
hi,
https://github.com/adamgreig/stm32-rs looks great, is there
something like this in Dlang?
thanks!
---
dangbinghoo
You might take a look at
https://github.com/JinShil/stm32f42_discovery_demo
and
https://github.com/JinSh
On Wednesday, 26 September 2018 at 05:55:49 UTC, dangbinghoo
wrote:
On Wednesday, 26 September 2018 at 05:24:08 UTC, Radu wrote:
On Wednesday, 26 September 2018 at 03:46:21 UTC, dangbinghoo
wrote:
hi,
https://github.com/adamgreig/stm32-rs looks great, is there
something like this in Dlang?
Looks like that there is no easy way to extract a function
parameters UDA list.
The following:
```
import std.traits;
struct s { string foo; }
void foo(@s("aaa") int a, bool x);
void main()
{
alias P = Parameters!foo;
enum udas = __traits(getAttributes, P);
pragma(msg, udas);
}
```
On Wednesday, 14 November 2018 at 18:05:55 UTC, Adam D. Ruppe
wrote:
On Wednesday, 14 November 2018 at 16:28:19 UTC, Radu wrote:
Looks like that there is no easy way to extract a function
parameters UDA list.
Indeed, the only way I can find is kinda crazy:
---
void foo(int f, @("test") string
On Friday, 16 November 2018 at 02:18:11 UTC, Ranjan wrote:
On Thursday, 15 November 2018 at 17:03:55 UTC, Andrea Fontana
wrote:
On Thursday, 15 November 2018 at 13:05:59 UTC, Ranjan wrote:
This is my first time on the Dlang forum. I like the language
but my usecase is a bit different.
I want
On Thursday, 6 December 2018 at 11:09:47 UTC, Basile B. wrote:
On Thursday, 6 December 2018 at 11:04:23 UTC, learnfirst1 wrote:
my question is how to easy use struct static initializer
method with UDA.
Fake code:
struct DbColumn {
string name;
boolunique ;
bool
On Friday, 25 January 2019 at 13:33:25 UTC, Alex wrote:
I'm experimenting with GC, and reading
https://dlang.org/spec/garbage.html#gc_config
There is an option setting possible via
´´´
extern(C) __gshared string[] rt_options = [ "gcopt=gc:precise"
];
//gc:conservative|precise|manual
´´´
conser
On Monday, 8 April 2019 at 13:42:31 UTC, Michal Minich wrote:
I used dmd 2.085.0 and 2.085.1 on Win 10
I followed sample at
https://vibed.org/blog/posts/a-scalable-chat-room-service-in-d
Just the beginning, where you you should compile hello word web
app.
command line: "dub"
compilation fin
On Wednesday, 1 May 2019 at 09:51:01 UTC, Laeeth Isharc wrote:
Second question. Lots of people these days start to program to
solve their problems at work but they may never have been shown
the basic principles of design, structuring and maintenance of
their code. If I could give them one bo
On Friday, 24 May 2019 at 09:52:38 UTC, Ron Tarrant wrote:
Today's blog post over on gtkDcoding.com is about using a GTK
dialog for saving a file. You can find it here:
http://gtkdcoding.com/2019/05/24/0038-file-save-dialog.html
Interesting posts you have.
I might not be the first one to ask
On Friday, 24 May 2019 at 11:06:47 UTC, Ron Tarrant wrote:
I'm still debating this idea, but I won't say I'm adamantly
opposed to it. Research into how people learn seems to support
both sides of the argument: should imagery be included or not?
And I suppose if I ever pull all this stuff toge
On Thursday, 24 October 2019 at 13:33:30 UTC, 9898287 wrote:
What's the function for converting a ulong to a native-endian
byte array?
For example,
auto bytes = 0x1234567890123456u64.to_ne_bytes();
// should yield
// [0x12, 0x34, 0x56, 0x78, 0x90, 0x12, 0x34, 0x56] in
big-endian and
// [0x56,
There is a weird rule on how compiler treats alias this for the N
and S types bellow.
As you can see, somehow S losses it's type and ends up a plain
string withing the Algebraic type. I would expect that all types
should be the treated the same, why a string alias will be
different then a boo
On Tuesday, 6 October 2015 at 06:37:16 UTC, Nicholas Wilson wrote:
On Monday, 5 October 2015 at 11:31:32 UTC, Radu wrote:
There is a weird rule on how compiler treats alias this for
the N and S types bellow.
[...]
Please file a bug report.
Also do the errors change if you reverse the order
On Tuesday, 6 October 2015 at 06:37:16 UTC, Nicholas Wilson wrote:
On Monday, 5 October 2015 at 11:31:32 UTC, Radu wrote:
There is a weird rule on how compiler treats alias this for
the N and S types bellow.
[...]
Please file a bug report.
Also do the errors change if you reverse the order
On Monday, 7 December 2015 at 08:17:27 UTC, Enjoys Math wrote:
Exception Message:
First-chance exception: std.format.FormatException Unterminated
format specifier: "%" at
C:\D\dmd2\windows\bin\..\..\src\phobos\std\format.d(828)
[CODE]
module set;
import std.conv;
struct Set(T) {
stri
51 matches
Mail list logo