Hi,
try to build a little programm, but need to know
how to check the input.
For example: input only numbers: 0 - 9 but 1.5 for example is ok.
thanks
thank you all! i will try
I'm trying to set up a game window with Derelict glfw and opengl.
When I perform a default (debug) build, it correctly shows a
window, but when I do this:
dub run "--build=release"
Then I get this:
object.Error@(0): Access Violation
0x00443BCF
0x00425164
0x00418545
0x00418874
On Saturday, 18 November 2017 at 14:15:21 UTC, Mike Parker wrote:
The proper place to report this sort of issue is at the
DerelictGL3 issues page [1]. You'll also want to include some
minimal, reproducible sample code.
Okay, I've made an issue:
I'm on Windows and I recently got confused by how Phobos
functions handle newlines.
```
void main() {
import std.stdio;
import std.path : buildPath, tempDir;
auto path = buildPath(tempDir(), "test.txt");
auto file = new File(path, "w");
file.write("hello there!\n");
Thanks for your reply, that clears it up.
On Monday, 11 December 2017 at 21:13:11 UTC, Steven Schveighoffer
wrote:
3. Stop using Windows ;)
Haha, if only the rest of the userbase would follow.
On Wednesday, 16 May 2018 at 02:47:50 UTC, Jon Degenhardt wrote:
Can you show the program you are using that throws when using
byLine?
Here's a version that only outputs the first chunk:
```
import std.stdio;
import std.range;
import std.algorithm;
import std.file;
import std.exception;
void
I have a file with two problems:
- It's too big to fit in memory (apparently, I thought 1.5 Gb
would fit but I get an out of memory error when using
std.file.read)
- It is dirty (contains invalid Unicode characters, null bytes in
the middle of lines)
I want to write a program that splits it
On Wednesday, 16 May 2018 at 08:20:06 UTC, drug wrote:
What is the purpose of `.drop(4)`? I'm pretty sure this is the
reason of the exception.
The file in question is a .json database dump with an array
"rows" of 10 million 8-line objects. The newlines in the string
fields are escaped, but
On Wednesday, 16 May 2018 at 08:20:06 UTC, drug wrote:
What is the purpose of `.drop(4)`? I'm pretty sure this is the
reason of the exception.
The file in question is a .json database dump with an array
"rows" of 10 million 8-line objects. The newlines in the string
fields are escaped, but
On Monday, 21 May 2018 at 11:38:12 UTC, SrMordred wrote:
what??
Here's another weird example:
```
void funWithUfcsAndPropertySyntax() {
import std.typecons : tuple;
"%s %s".writefln = ("foo".tuple = "bar").expand;
}
```
source:
On Thursday, 17 May 2018 at 21:10:35 UTC, Dennis wrote:
It's unfortunate that Phobos tells you 'there's problems with
the encoding' without providing any means to fix it or even
diagnose it.
I have to take that back since I found out about std.encoding
which has functions like `sanitize`,
On Monday, 21 May 2018 at 17:42:19 UTC, Jonathan M Davis wrote:
On Monday, May 21, 2018 15:00:09 Dennis via Digitalmars-d-learn
wrote:
drop is range-based, so if you give it a string, it's going to
decode because of the whole auto-decoding mess with
std.range.primitives.front and popFront
On Wednesday, 16 May 2018 at 10:30:34 UTC, Jonathan M Davis wrote:
For various reasons, that doesn't always hold true like it
should, but pretty much all of Phobos is written with that
assumption and will generally throw an exception if it isn't.
It's unfortunate that Phobos tells you
On Wednesday, 16 May 2018 at 15:47:29 UTC, Jon Degenhardt wrote:
If you write it in the style of my earlier example and use
counters and if-tests it will work. byLine by itself won't try
to interpret the characters (won't auto-decode them), so it
won't trigger an exception if there are invalid
On Thursday, 14 June 2018 at 11:31:50 UTC, Robert M. Münch wrote:
Is this possible? I read about Inputranges, took a look at the
RBTree code etc. but don't relly know/understand where to start.
You can also use opApply to iterate over a tree using foreach,
see:
On Friday, 1 June 2018 at 21:18:25 UTC, IntegratedDimensions
wrote:
If one has a switch of N case then the last cost surely does
not cost N times the cost of the first, approximately?
It depends on the compiler and optimization level. In general, no
optimization or just a handful of cases
On Friday, 9 February 2018 at 14:51:30 UTC, Mike Parker wrote:
Where was the lib file located? Was it in the root project
directory? How are you compiling your project? What does your
directory tree look like?
(...)
That depends. Is that the directory where your executable is
written? Are you
On Friday, 9 February 2018 at 18:14:06 UTC, Mike Wey wrote:
You may need to pass `/s` to implib so it will add the
underscore to the symbol in the import library. If it's
actually needed depends on what the dll uses.
That did it, now both dynamic loading and dynamic linking work.
:) Thanks
I want to bind to a .dll on Windows, so I looked at how Derelict
packages are doing it and found it does it like this:
```
extern(C) {
alias da_CoreGetAPIVersions = m64p_error
function(int*,int*,int*,int*);
...
}
__gshared {
da_CoreGetAPIVersions CoreGetAPIVersions;
...
}
protected
I read the Derelict documentation a while ago, I didn't grasp all
of it. Reading it again, I can now make sense of it though. :)
On Friday, 9 February 2018 at 12:53:44 UTC, Mike Parker wrote:
Did you link with the library you created with implib? That
linker error suggests you didn't.
I
I recently tried to go to that site, and I tried `run.dlang.com`
which is the wrong URL. So I was looking through the D homepage
for the right link but couldn't find it. Even a Google search for
"online d compiler" or "run dlang online" didn't turn up anything
directly, I had to go through the
I was trying to translate this kind of C code to D:
void calc(unsigned char *buf) {
(...)
res = read_u32_be([i]);
}
So I tried this:
import std.bitmanip : read, Endian;
void calc(ubyte[] buf) {
(...)
res = read!(uint, Endian.bigEndian)(buf[i..$]);
}
But then I get this error:
template
Ah, so it's about lvalues an rvalues, not the type of the range.
Makes sense now.
On Tuesday, 26 December 2017 at 22:33:54 UTC, WebFreak001 wrote:
BigEndian is default btw, you don't need to specify that but
you can if you want.
Dealing with Endianness bugs has been such a pain, I like to be
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
I have a two dimensional static array in a game board struct and
want to explicitly set the default value for each cell. Now
typing the whole 9x9 array out would be cumbersome and I can't
change the default constructor of a struct, so I played around
with initializers and found some... strange
On Sunday, 19 August 2018 at 12:10:08 UTC, kinke wrote:
I think the spec is pretty clear; the elements of the
right-hand-side initializer array are interpreted as
per-element initializer, i.e., `result[0] = 2, result[1] = 1`
(rest: default-init).
I can't find where in the spec it says that
On Saturday, 1 September 2018 at 21:53:03 UTC, aliak wrote:
Anyway around this?
I don't know if your situation allows it, but you can mark f
explicitly as always @nogc. If your design assumes that it's
@nogc, it's a good idea to add the attribute anyway.
You can also use the C printf
On Sunday, 9 September 2018 at 08:41:37 UTC, Christian Mayer
wrote:
As of my current understanding "char" will create a new
variable and copy the content of the original to the new
variable. "char*" will just use the pointer. And "const char*"
is good for when not modifying. But I also can
On Friday, 9 February 2018 at 20:19:33 UTC, Dennis wrote:
I'd still like to find a nice way to generate the boilerplate
code for dynamic loading, if I come up with something I'll post
it here.
So I ended up using an import library for a while, but I then
wanted to get the handle of the DLL,
On Sunday, 15 April 2018 at 12:04:19 UTC, vladdeSV wrote:
How would I go on about to print all the arguments as I
expected it, using "%s"?
You can expand the template arguments into an array by putting it
into square brackets: [args]. You can format an array with the
default notation using
On Monday, 2 April 2018 at 13:57:14 UTC, Vladimirs Nordholm wrote:
Is there any reason for me to add the @property tags for the
method?
A list of things the @property tag does can be found here:
https://dlang.org/spec/function.html#property-functions
This behavior is particularly useful for
On Monday, 2 April 2018 at 14:51:57 UTC, Vladimirs Nordholm wrote:
Do you think I should I omit the @property tag, if the only
wanted behaviour is to set a value (`foo.bar = "baz";`) ?
You're probably fine either way, it's mostly for making your
intention clear. Jonathan M Davis made a great
On Thursday, 29 March 2018 at 15:16:07 UTC, Ivan Kazmenko wrote:
So, why do delegates of guns[] and huns[] all return 1, and how
to correctly reproduce the behavior of funs[] while populating
it in a loop?
A delegate is a function with a pointer to the stack frame where
it was created. It
On Tuesday, 20 March 2018 at 10:20:55 UTC, Dennis wrote:
On Tuesday, 20 March 2018 at 09:51:09 UTC, bauss wrote:
Besides if it was and it took 1 second to startup, then it
wouldn't matter in practice with an actual application.
This is not concerning for large applications indeed. But say,
I
On Tuesday, 20 March 2018 at 09:51:09 UTC, bauss wrote:
Besides if it was and it took 1 second to startup, then it
wouldn't matter in practice with an actual application.
This is not concerning for large applications indeed. But say, I
want to implement my own `dir` (= `ls` on Unix) in D.
Simply running a "hello world.exe" takes, on my pc:
1.12s When compiled with dmd
0.62s When compiled with ldc
0.05s When compiled with dmc (C program) or dmd/ldc as a -betterC
program
I suppose initializing the runtime takes a lot of time. When
making a simple command line utility, half a
On Wednesday, 21 March 2018 at 13:26:48 UTC, HeiHon wrote:
I added exclusions for the folder, where I installed dmd and
ldc and I added an exclusion for the folder, where I compile my
D programs. Now startup of dmd and freshly compiled programs is
fast again.
I've done this too now, thanks
On Sunday, 18 March 2018 at 22:57:15 UTC, aliak wrote:
// But you get a:
// Error: Using the result of a comma expression is not
allowed
// writeln(mixin(arguments!f));
You can't mix part of a function call in: "Mixed in text must
form complete declarations, statements, or
On Tuesday, 20 March 2018 at 12:18:16 UTC, Adam D. Ruppe wrote:
On Tuesday, 20 March 2018 at 09:44:41 UTC, Dennis wrote:
I suspect you are seeing the Windows antivirus hitting you. D
runtime starts up in a tiny fraction of a second, you shouldn't
be noticing it.
You're totally right,
I was making a stack interface for an array:
```
struct Stack(T) {
import std.array: empty;
T[] stack;
alias stack this;
}
void main()
{
Stack!int stack;
bool x = stack.empty;
}
```
My expectation is that you can now call `empty` on a stack
instance since I imported it in
On Friday, 5 October 2018 at 10:03:35 UTC, Kagamin wrote:
GC allocations are 16 bytes aligned.
Is that an implementation detail or well-defined behavior?
On Wednesday, 17 October 2018 at 15:51:21 UTC, Codifies wrote:
okay I should have carried on reading the blog, its so
uninitialized values stick out when debugging...
Indeed, the initial value is not supposed to be useful, it's
there because dealing with garbage memory when forgetting to
On Wednesday, 17 October 2018 at 00:12:13 UTC, H. S. Teoh wrote:
I'm not sure what's the reasoning behind the saying that
throwing exceptions in ctors is bad, but exceptions are exactly
the kind of thing designed for handling this sort of situation.
If the parser detects a problem early (i.e.,
I've always been curious around the design choice of ranges to
make front and popFront separate functions, instead of having
popFront return the front. I suppose it is useful sometimes to be
able to access front multiple times without having to save it
temporarily (can't think of a specific
On Monday, 5 November 2018 at 03:13:26 UTC, Vladimir Panteleev
wrote:
cmd.exe will interpret \` verbatim (i.e. as \`), so, try not
quoting the ` characters (or just replace them with . if you
want the command to work in both shells).
Of course, the one thing I didn't try. Thanks!
On Friday, 9 November 2018 at 19:40:15 UTC, Mike Parker wrote:
When you link statically with a library, you have to link with
all of its dependencies, too. For GLFW, you'll need User32.lib,
gdi32.lib, and OpenGL32.lib, off the top of my head.
Aha. Now I wonder why LDC includes those
On Friday, 9 November 2018 at 19:21:30 UTC, kinke wrote:
May be worth another try with the proper command line.
Thank you! LDC + LD now works without warnings.
On Friday, 9 November 2018 at 19:21:30 UTC, kinke wrote:
Run LDC or DMD with `-v`, that gives you the linker command
line at the end
On Thursday, 8 November 2018 at 23:43:38 UTC, Murilo wrote:
It finally worked, but I can't just compile it normally, I have
to use dub run, I wish it were something simple that I just
download into the folder and then use an import statement and
then compile it like any other program. I wish
On Wednesday, 14 November 2018 at 12:28:38 UTC, Per Nordlöw wrote:
Is it because of `group` has a default for the predicate
whereas `chunkBy` hasn't.
chunkBy splits the range into smaller ranges, group actually
returns tuples of the item and the amount of occurences. Because
in group the
On Friday, 9 November 2018 at 10:45:49 UTC, Vinay Sajip wrote:
As I see it, a ubyte 0x20 could be decoded to an ASCII char '
', and likewise to wchar or dchar. It doesn't (to me) make
sense to decode a char to a wchar or dchar. Anyway, you've
shown me how decodeFront can be used, so great!
On Friday, 9 November 2018 at 09:47:32 UTC, Vinay Sajip wrote:
std.utf.decodeFront(Flag useReplacementDchar =
No.useReplacementDchar, S)(ref S str) if (isInputRange!S &&
isSomeChar!(ElementType!S))
This is the overload you want, let's check if it matches:
ref S str - your InputRange can be
I'm trying the static bindings for glfw of bindbc on Windows,
using the pre-compiled .lib files from the lib-vc2015 folder in
the official download.
(http://code.dlang.org/packages/bindbc-glfw)
With LDC using the Microsoft MSCV linker, everything works. I can
either add this:
app.d:
```
On Friday, 9 November 2018 at 18:19:22 UTC, Dennis wrote:
[...]
I just noticed in the section about the static version:
"This requires the GLFW development package be installed on your
system at compile time."
http://code.dlang.org/packages/bindbc-glfw
I don't see where I can install the
I am debugging a case where operator overloading seems to break
when I define the opBinary templates in a mixin template. On my
own simple test-case it worked fine, so I'm trying to reduce my
current code with dustmite.
The file tree is simply:
myproject/
q16.d
And the command I run is:
On Friday, 21 September 2018 at 07:25:17 UTC, Chris Katko wrote:
I get "Error: template instance `reduce!((a, b) => a + b)`
cannot use local __lambda1 as parameter to non-global template
reduce(functions...)" when trying to compile that using the
online D editor with DMD and LDC.
Any ideas?
On Sunday, 18 November 2018 at 18:17:54 UTC, Stanislav Blinov
wrote:
// implement separate methods for
mutable/const/immutable
Thanks. I should have tried that, but I assumed it wouldn't work
since you can't overload on return-type only. However, the const
/ non-const makes it
I'm making a fixed point numeric type and want it to work
correctly with const. First problem:
```
const q16 a = 6;
a /= 2; // compiles! despite `a` being const.
writeln(a); // still 6
a.toQ32 /= 2;// what's actually happening
```
My q16 type has an implicit conversion to q32
On Friday, 16 November 2018 at 20:13:42 UTC, Vinay Sajip wrote:
More complicated for the compiler writers, or users of
mixins/generics?
For users of generics. It's hard to come up with an actual
example because I don't know why one would ever use this, but in
this concocted scenario:
```
On Friday, 16 November 2018 at 18:37:00 UTC, Vinay Sajip wrote:
Design flaws in what?
Design flaws in the language.
Quoting Jonathan M Davis:
"Honestly, in general, warnings are a terrible idea. Anything
that's a warning in your code has to be fixed, because it's bad
practice to leave
The most fundamental problem that these features tackle is that
code is costly, so making code-bases smaller and more reusable
saves effort spent on maintaining large code-bases and rewriting
code to suit a different situation.
On Friday, 21 December 2018 at 12:39:48 UTC, Ron Tarrant wrote:
On Monday, 10 December 2018 at 21:16:23 UTC, aliak wrote:
Does this fix your issue?
struct S {
mixin operators ops;
S opBinary(string op, T)(T a) {
alias opBinary = ops.opBinary; // explicitly alias
opBinary in this scope
return opBinary!op(a);
}
}
It does,
On Friday, 7 December 2018 at 18:51:27 UTC, Arun Chandrasekaran
wrote:
Why is there a difference in the behavior?
Your first assert expression is looking for a string in a larger
string, your second expression looks for hay which is not a
string but a string[]. To flatten the array, use:
On Monday, 3 December 2018 at 10:00:31 UTC, Simen Kjærås wrote:
However, it's easy to implement in a library:
It even is in phobos:
https://dlang.org/phobos/std_array.html#.staticArray
```
import std.array: staticArray;
auto a = [0, 1, 2].staticArray;
```
On Thursday, 6 December 2018 at 07:37:12 UTC, John Chapman wrote:
Is the compiler giving the non-mixed-in function special
treatment?
I think you're running into this bug:
https://issues.dlang.org/show_bug.cgi?id=19365
I see that it is not limited to operator overloading, in general
the
I'm using Adam's workaround from
https://issues.dlang.org/show_bug.cgi?id=19365, but now I have
endless recursion. Reduced code:
```
mixin template operators() {
S opBinary(string op: "+")(S rhs) {
return rhs;
}
// (A)
auto opBinary(string op, T)(T rhs) if (false) {
On Sunday, 9 December 2018 at 18:36:50 UTC, Dennis wrote:
Does anyone know how to get this working?
I added this to the mixin template:
```
alias mixinOpBinary = opBinary;
```
And called mixinOpBinary instead in the forwarded function. I
think that solved it. I think I'll just file an issue
On Sunday, 18 November 2018 at 22:30:52 UTC, Rubn wrote:
Yah most people tend to avoid const for this reason. It only
really works for basic types, if you have a "const int" you can
convert it to an "int" by copy. But if you have a type like
Vector!(const int) that won't work, you can't even
On Monday, 19 November 2018 at 01:13:29 UTC, Stanislav Blinov
wrote:
You just dismissed that second to last sentence, did you? :)
I don't know what you mean with it. It's not that I'm trying to
be sneaky or lazy really trying to modify the const parameter
when I should treat it properly. And
On Monday, 19 November 2018 at 01:24:02 UTC, Stanislav Blinov
wrote:
Yup, that's because, like Rubn said, copying value types is
trivial. Where it all comes to bite you is when you start
having pointers, because you can't copy a const(T)* into a T*.
I'm not using reference types, but still:
On Monday, 19 November 2018 at 02:39:32 UTC, Stanislav Blinov
wrote:
You're skimming the examples ;)
I'm not saying your examples don't work, I'm trying to understand
the minimum requirements. You said:
"That's [constructors needing to be pure is] only for types with
indirections
On Monday, 19 November 2018 at 13:34:50 UTC, Stanislav Blinov
wrote:
Because it's not mutation, it's initialization.
Oh. That's an epiphany for me.
When a ctor is `pure`, the compiler knows it doesn't mutate any
state other than the object's, so it allows conversion to all
three
On Friday, 11 January 2019 at 19:45:05 UTC, Head Scratcher wrote:
How can I read the file and convert the string into proper
UTF-8 in memory without an exception?
You have multiple options:
```
import std.file: read;
import std.encoding: transcode, Windows1252String;
auto ansiStr =
On Tuesday, 2 April 2019 at 08:38:28 UTC, Per Nordlöw wrote:
Is there a way (compiler flag) to forbid implicit conversions
from an enum type to integer types?
You can make the enum type not an integer type.
```
struct Int{int i;}
enum E: Int {
first = Int(0),
second = Int(1),
}
```
On Tuesday, 2 April 2019 at 09:37:26 UTC, Per Nordlöw wrote:
Are there any plans on deprecating implicit conversions of
enums to integers?
Not that I know of. Given the precedence of this:
https://github.com/dlang/DIPs/blob/master/DIPs/rejected/DIP1015.md
I doubt enum/integer-types are going
On Sunday, 7 April 2019 at 18:22:00 UTC, Robert M. Münch wrote:
Error: no property sort for type Tuple!(uint, "key", int,
"value")[]
Did you import it?
import std.algorithm;
On Monday, 8 April 2019 at 07:53:23 UTC, Robert M. Münch wrote:
Why does DMD not give a hint, that an import from the standard
lib might be missing? I find these explicit import statements
very annyoing.
There currently are a few hard-coded import hints for common
functions:
On Sunday, 24 February 2019 at 10:53:09 UTC, aliak wrote:
But the following code is very recoverable and I don't see how
it's unsafe to continue executing:
There is no guarantee that a final switch throws an Error. From
what I've heard of Walter [1] (though I can't find it in the
spec), the
On Saturday, 16 March 2019 at 03:47:43 UTC, Murilo wrote:
Does anyone know if when I create a variable inside a scope as
in
{int a = 10;}
it disappears complete from the memory when the scope finishes?
Or does it remain in some part of the memory? I am thinking of
using scopes to make
On Thursday, 14 March 2019 at 19:46:30 UTC, spir wrote:
But the doc (the language ref for the matter) should definitely
say what you just explained above, shouldn't they?
Well arguably, the spec should detail the language semantics
formally and not just be a description of the reference
On Friday, 8 March 2019 at 11:42:11 UTC, Simon wrote:
Thanks, this works flawlessly. Out of interest: what is the
"enum" doing there? I had the exact same behaviour in a
function before, that I only called at compile-time, so why did
it complain then? Can I somehow tell the compiler that a
On Sunday, 10 March 2019 at 08:59:59 UTC, kerdemdemir wrote:
Can I avoid for loops and solve my problem with std algorithms
or ranges ?
Try slide: https://dlang.org/phobos/std_range.html#slide
And then use map.
On Sunday, 10 February 2019 at 20:25:02 UTC, Murilo wrote:
It seems this is a feature of D I will have to get used to and
accept the fact I can't always get the same number as in C
What compilers and settings do you use? What you're actually
comparing here are different implementations of the
I assumed that casting an int[] to a ubyte[] would keep all bytes
and quadruple the length of the original array. But when the
array is a literal, it keeps the same length but truncates every
int element to a ubyte:
```
import std.stdio;
void main()
{
// enum:
enum litA =
On Friday, 15 February 2019 at 17:18:28 UTC, H. S. Teoh wrote:
Why? because that's the only case where you can reinterpret the
.sizeof*.length bytes as an array of a different type. There
is no conversion, the cast works as a reinterpretation. It's
by design.
But my problem is that it
On Tuesday, 19 February 2019 at 14:34:09 UTC, drug wrote:
Now I do it this way (https://run.dlang.io/is/8kVibT):
```
auto some_duration = dur!"msecs"(500);
auto seconds = some_duration.total!"hnsecs" / 10_000_000.0;
assert(seconds.approxEqual(0.5));
```
is there better
On Monday, 8 April 2019 at 18:04:28 UTC, kdevel wrote:
What's the purpose of .release? The documentation in
https://dlang.org/phobos/std_range.html#.SortedRange.release is
rather monosyllabic.
The sort function returns a SortedRange, which is usually an
array wrapper with the extra type
On Monday, 8 April 2019 at 19:54:28 UTC, WhatMeWorry wrote:
Now, I've studied the on-line documentation and even walked
through the code somewhat but I'm not making an headway.
Very relatable. My tips so far are:
- Look for projects in github with a similar structure to yours
and look at
On Friday, 12 April 2019 at 10:49:19 UTC, Jamie wrote:
I was trying to declare a static variable dependent on another
static variable, but it didn't work. Are static variables not
known to other static variables at compile time?
Add `const` or `immutable` to A and it will work.
I don't know
On Sunday, 26 May 2019 at 18:14:23 UTC, Jacob Carlborg wrote:
No, that's not possible.
Some hacky solutions are possible by importing a source file as a
string and parsing it manually. dglsl actually extracts D
function code to put into glsl shaders. Here's the snippet. See:
On Tuesday, 4 June 2019 at 16:30:41 UTC, BoQsc wrote:
Is there any way to prompt for administrator's rights, to save
the additional effort of lots of clicks?
Looking at:
https://stackoverflow.com/questions/31844584/is-there-an-api-call-to-prompt-user-for-uac-elevation
You can try something
On Sunday, 2 June 2019 at 16:39:57 UTC, Rnd wrote:
Is it not possible in the language to have template map
function also to called as map(x=>... ?
That would be slower, and std.algorithm generally disallows easy
but slow functions.
In Java, you can sort a linked list. In D, sort requires an
On Thursday, 20 June 2019 at 19:09:11 UTC, Emmanuelle wrote:
Is there any trait or Phobos function for transforming a
function/delegate/lambda/whatever's body into a string suitable
for `mixin(...)`? For example:
See:
https://forum.dlang.org/post/kozwskltzidfnatbp...@forum.dlang.org
If not,
On Tuesday, 18 June 2019 at 12:26:14 UTC, lili wrote:
Hi guys:
Is the Dlang fix-length array alloc on stack? when a test
writeln([1]).sizeof //16
writeln([2]).sizeof //16
Why, What is the fix-length array memory layout.
I'm assuming you mean writeln([1].sizeof).
An array
On Thursday, 9 May 2019 at 09:52:21 UTC, XavierAP wrote:
alias parameters are used for functions (in the general sense).
Why this instead of specifying and typing the parameter
functions or delegates?
With function pointers, there is extra indirection and the
function can not be inlined.
On Monday, 20 May 2019 at 11:10:32 UTC, Boqsc wrote:
I'm frozen in learning basics of D lang since I want to create
a simple game and I really would like a clean and simple code,
For a simple game, I think it's the easiest to just store an
integer of cents (or the lowest amount of currency
On Monday, 20 May 2019 at 12:09:02 UTC, Alex wrote:
void* data;
auto x = cast(byte[A,B,C])data;
X is then an AxBxC matrix.
It sounds like you're looking for ndslide from mir
http://code.dlang.org/packages/mir-algorithm
```
ubyte data[];
auto x = x.sliced(A, B, C);
```
It should be pretty
I was replacing a memcpy with a slice assignment and accidentally
used == instead of =.
Usually the compiler protects me from mistakes like that:
```
int[4] a;
a == a;
```
Error: a == a has no effect
However, because I was using slices it didn't:
```
int[4] a;
a[] == a[];
```
No errors
Does
On Friday, 3 May 2019 at 06:20:37 UTC, Mike Parker wrote:
If you compile with -m32mscoff for 32-bit or -m64, DMD will use
the Microsoft linker and import libraries if you have Visual
Studio or the MS Build tools installed, and the LDC linker with
some import libraries from MinGW if you don’t.
On Sunday, 5 May 2019 at 18:07:10 UTC, Adam D. Ruppe wrote:
The std.stdio one is supposed to be an error; the old buggy
behavior was to bypass the private import in these cases and
that is why it is deprecated pending changes.
Thanks, that answers my question. The old private-bypassing
1 - 100 of 191 matches
Mail list logo