On Friday, 2 February 2024 at 21:01:53 UTC, Paul Backus wrote:
No, D only does bottom-up type inference, not top down.
If you want to avoid repeating the type, use `auto` on the left
side:
```d
auto time = to!uint(data[1]);
auto priority = to!int(data[2]);
```
Okay thanks. It finally
Is there some way to do:
```D
string[3] data; //strings from some file input, some are ints,
uints, etc.
auto into!(T)(T value){return to!???(value); } // ???
uint time = into!(data[1]); // We already know this is uint
int priority = into!(data[2]);
```
instead of:
```D
uint time =
I know that sounds stupid on the face of it. An interface
shouldn't change. But consider this:
A frame timer and a clock timer(seconds) that re-use
functionality from a parent class/interface.
```
class timerType
{
void start() = 0;
void stop() = 0;
void
On Monday, 17 July 2023 at 03:43:04 UTC, Alain De Vos wrote:
Is it possible to print runtime memory usage of:
-The stack
-The heap
-The garbage collector ?
there's gc.stats for part of it:
https://dlang.org/library/core/memory/gc.stats.html
On Thursday, 6 July 2023 at 06:00:04 UTC, Cecil Ward wrote:
My program is instrumented with a load of writeflns. At one
point it looks as though it suddenly quits prematurely because
the expected writeflns are not seen in the output. It could be
that I am just reading the flow of control wrong
On Wednesday, 5 July 2023 at 22:27:46 UTC, Andrew wrote:
So, I've gotten the itch to have a go at game development in D,
after doing a bit of it in Java last year. I've previously used
LWJGL, which is a java wrapper for OpenGL, OpenAL, GLFW, and
some other useful libs.
The problem is,
https://dlang.org/install.html#activate
I ran the two curl liners for grabbing DMD and LDC newest.
So now I have ~/dlang/ldc-1.32.2 and ~/dlang/dmd-2.104.0
How am I supposed to have both "activated"? Why does LDC have to
override DMD, and DMD have to override LDC in the PATH?
I have both
On Thursday, 29 June 2023 at 18:27:22 UTC, Cecil Ward wrote:
I’m trying to debug my D program with old-fashioned printfs
stuck in various strategic places, actually using writefln().
My problem is that the addition of printf fights with the
existing declarations for pure nothrow @nogc @safe
On Tuesday, 27 June 2023 at 22:34:17 UTC, Adam D Ruppe wrote:
On Tuesday, 27 June 2023 at 22:20:22 UTC, Chris Katko wrote:
pragma(msg, t.stringof); // does not see any new fields!
D's declarations are all order-independent, in theory those
foreaches are done simultaneously,
Does anyone know why the new variables don't show up after the
static foreach?
I have a struct, it has some marked fields. I want to note those
fields at compile time and make some similarly named fields like
myField becomes myField__replicated.
The code doesn't _have_ to be inside the
On Tuesday, 27 June 2023 at 04:56:19 UTC, Ali Çehreli wrote:
On 6/26/23 21:25, Chris Katko wrote:
> How do I get just the field name?
I know .tupleof, which you can typeof() as well:
class myObject{
int field1, field2, field3;
static foreach(field; typeof(this).tupleof)
{
inside a static foreach I can do
```
enum rep;
class myObject{
int field1, field2, field3;
static foreach(field; getSymbolsByUDA!(typeof(this), rep))
{
pragma(msg, field); // fails
pragma(msg, fullyQualifiedName!field); // works
}
}
```
error for pragma(msg, field)
```
I'm trying to figure out how to return a reference to something
that may not be a reference type.
```D
struct stats
{
float[string] data=0;
float ref opIndex(string key)
{
return data[key]; // want a ref to a specific element
}
}
void test()
{
stats foo;
auto x = foo.bar(); // returns
```D
class bitmapHandler
{
bitmap*[string] bmps;
void get(string name){return bmps[name]; /* plus other code */}
}
void usage()
{
bitmapHandler bh;
bitmap foo = bh.get("bar"); // works
bitmap foo2 = bh["bar"]; // desired
}
```
Should I be using opEquals? Or something different? The problem
dscanner reports this as a warning:
```D
struct foo{
this()
{
/* some initial setup */
refresh();
}
void refresh() { /* setup some more stuff */}
// [warn] a virtual call inside a constructor may lead to
unexpected results in the derived classes
}
```
Firstly, are all calls virtual
On Saturday, 18 March 2023 at 20:42:50 UTC, Nick Treleaven wrote:
On Saturday, 18 March 2023 at 19:22:07 UTC, Chris Katko wrote:
...
So there's multiple sub-problems to solve. I asked this years
ago, and got 90% of the way done and then lost the code and
cannot find the original forum post.
Given:
```D
struct pos {float x, y;}
draw(myBitmap, pos(320, 240), centered);
draw(pos(320, 240), myBitmap);
draw("text", myFont, pos(320, 240));
```
I'm writing a general "draw" template function that through
compile-time, calls an associated DAllegro/Allegro 5 function:
```
draw(myBitmap,
```D
struct pair
{
float x;
float y;
}
pair[10] values;
import std.conv;
auto valuesInCStyle = to!(const float*)(values);
```
Now that's not going to work because (I would imagine) to!
doesn't understand x, and y, can be placed in order to give an
array of:
valuesInCStyle =
On Friday, 1 July 2022 at 13:28:26 UTC, Chris Katko wrote:
...wait, does "world" not 'exist' until after the constructor
finishes? Is that's what's going on? But then why does it
'exist' when I send it directly? Is it only "registered" with
the module once this() finishes or something like
On Friday, 1 July 2022 at 13:12:05 UTC, Adam D Ruppe wrote:
On Friday, 1 July 2022 at 12:57:01 UTC, Chris Katko wrote:
Cannot access memory at address 0x10
Looks like an ordinary null pointer. How did you create the
variable?
D
bool initialize() //called from main
{
Forgot the last line. That's important because world MUST exist
by time elf is called... because world... created and called elf.
So it's not a memory issue, but some sort of linkage issue.
To add, I cannot even access g.world from inside elf's
constructor.
... which is the function that called it.
D
Thread 1 "main" received signal SIGSEGV, Segmentation fault.
objects.elf.this(g.pair, objects.atlasHandler) (this=, atlas=,
_pos=...) at ./src/objects.d:320
(gdb) bt
#0
dmd (but I think LDC also is affected)
this bug has bit me multiple times now, to the point I can
recognize it. Accessing module variables, from inside a method,
causes a segfault. Even if the variable should be available by
then through the call order. Proving that its a bug, you can
On Wednesday, 22 June 2022 at 12:42:48 UTC, Steven Schveighoffer
wrote:
On 6/22/22 2:05 AM, monkyyy wrote:
On Monday, 20 June 2022 at 13:20:51 UTC, Steven Schveighoffer
wrote:
And you can also use an inner struct to define overloaded
functions.
I believe templates make a better bandaid
```d
On Saturday, 18 June 2022 at 17:52:16 UTC, Adam D Ruppe wrote:
On Saturday, 18 June 2022 at 17:37:44 UTC, Chris Katko wrote:
D
struct pair { float x, y;}
pair p[] = [[0, 0], [255, 255], [25,-25]]; //nope
An array of pair is `pair[]`, keep the brackets with the type.
Then a struct
D
struct pair { float x, y;}
pair p[] = [[0, 0], [255, 255], [25,-25]]; //nope
I'm having difficulty figuring out exactly what signature D is
expecting.
D
enum DIR
{
UP = 0,
DOWN,
LEFT,
RIGHT,
UPLEFT,
UPRIGHT,
DOWNRIGHT,
DOWNLEFT,
On Friday, 17 June 2022 at 12:19:33 UTC, bauss wrote:
On Friday, 17 June 2022 at 12:09:33 UTC, Chris Katko wrote:
I don't need this functionality, but I wanted to be sure.
Does function overloading not work with nested functions? I
got a compiler error (something like "function already
I don't need this functionality, but I wanted to be sure.
Does function overloading not work with nested functions? I got a
compiler error (something like "function already defined") when I
tried it.
On Friday, 10 June 2022 at 17:26:48 UTC, Ali Çehreli wrote:
On 6/10/22 08:13, z wrote:
> arrays of arrays has different order for declaration and
addressing,
> and declaring array of arrays has different order depending
on how you
> declare it and wether it's static or dynamic array, *oof*)
>
>
On Friday, 10 June 2022 at 17:37:30 UTC, Chris Katko wrote:
I want to pipe in string data to a shell/commandline program,
then retrieve the output. But the documentation I read appears
to only show usage for 'Files' for stdin/stdout/stderr.
ala something like this:
D
string input =
I want to pipe in string data to a shell/commandline program,
then retrieve the output. But the documentation I read appears to
only show usage for 'Files' for stdin/stdout/stderr.
ala something like this:
D
string input = "hello\nworld";
string output;
runProcess("grep hello", input,
Is it somehow possible to use a struct as a [multidimensional]
array index:
D
struct indexedPair
{
size_t x, y;
}
bool isMapPassable[100][100];
auto p = indexedPair(50, 50);
if(isMapPassable[p]) return true;
Probably not, but I'm curious.
D
struct pair
{
float x,y;
}
myFunction(float taco, float x, float y, float burrito)
{
// stuff
}
myfunction(_taco, _x, _y, _burrito); // call function
// But can we do this?
pair p;
myfunction(_taco, p; _burrito); // p becomes (x,y) and satisfies
the two floats in the signature
On Thursday, 19 May 2022 at 10:35:30 UTC, ag0aep6g wrote:
On 19.05.22 12:15, 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 =
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 do:
```D
auto myColor = GREY!(0.5);
// where GREY!(0.5) becomes
On Friday, 13 May 2022 at 07:05:36 UTC, vit wrote:
On Friday, 13 May 2022 at 06:43:39 UTC, Chris Katko wrote:
I have an intrinsicGraph(T) class that is given a pointer to a
T dataSource and automatically polls that variable every frame
to add it to the graph, whether it's a float, double,
I have an intrinsicGraph(T) class that is given a pointer to a T
dataSource and automatically polls that variable every frame to
add it to the graph, whether it's a float, double, integer, and
maybe bool.
This all works fine if you have a single template type. But what
if I want ... multiple
On Thursday, 12 May 2022 at 16:04:09 UTC, Ali Çehreli wrote:
My view on private has changed over the years. I need to be
convinced that there is usage that needs to be protected. :) I
don't see people using types freely especially the ones that
are in the same module. The only argument for
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); //draw red pixel to bitmap b (b is
implied above)
}
But
On Monday, 25 April 2022 at 12:53:14 UTC, Mike Parker wrote:
On Monday, 25 April 2022 at 08:54:52 UTC, Chris Katko wrote:
D
struct pair
{
float x,y;
}
alias sPair = Typedef!pair; // pair of xy in screen space
coordinates
alias vPair = Typedef!pair; // pair of xy in viewport space
D
struct pair
{
float x,y;
}
alias sPair = Typedef!pair; // pair of xy in screen space
coordinates
alias vPair = Typedef!pair; // pair of xy in viewport space
coordinates
//etc
void test()
{
pair v0 = pair(1f, 2f); // works fine, but what about the
typedefs?
vPair v1 = vPair(1f, 2f);
D
struct map_t{
int data[50][50];
} map;
//save
std.file.write("save.map", map.data); // compiles
//load
map.data = std.file.read("save.map", map.data.sizeof); // error
main.d(536): Error: cannot implicitly convert expression
`read("save.map", 2500LU)` of type `void[]` to `ubyte[50][]`
Using DMD. v2.098-beta-2
Not sure if right terminology. But I just wrote a nested function
that uses a variable outside its body. The capture (right term?)
is obvious where the invocation is. However, I have to move the
declaration of the variable to above the nested function for it
to
Running 64-bit Linux
```
dmd --version
DMD64 D Compiler v2.098.0-beta.2
dub --version
DUB version 1.27.0-beta.2, built on Sep 7 2021
```
the following code 'compiles' in one project.
```d
unittest
{
gasdindgaslkdgansklnasgdlknaglkgansklsdg;
}
void main(){} // compiles, links, and 'runs unit
On Sunday, 5 December 2021 at 16:32:16 UTC, rikki cattermole
wrote:
The string is not the problem.
```d
string ip_address = "192.168.1.1";
auto x = new InternetAddress(ip_address, 8008);
```
That works.
A string in D is an alias for immutable(char)[]. This is
defined in druntime (object.d).
All I want:
```d
string ip_address = "192.168.1.1";
auto x = new InternetAddress( ip_string, "8008");
```
```d
source/app.d(161,16): Error: none of the overloads of `this` are
callable using argument types `(string, int)`
/usr/include/dmd/phobos/std/socket.d(1472,5):Candidates
are:
there's:
```d
import core.thread;
Thread.sleep( dur!("msecs")(10) );
```
but what if you want to simply yield all remaining time back to
the time scheduler?
Is there a D std.library accessible version of POSIX sched_yield:
https://man7.org/linux/man-pages/man2/sched_yield.2.html
It
Is there any automatic compiler-based or library methods for
detecting NaNs? I mean, if the compiler is outputting code that
it knows is going to be set in memory to NaN, why isn't it giving
me at least a compiler warning? Is that some sort of "NP
complete" can't-fix issue or something?
I
On Friday, 17 September 2021 at 10:29:12 UTC, bauss wrote:
On Friday, 17 September 2021 at 09:44:53 UTC, Chris Katko wrote:
[...]
It's not a bug because "obj.x" referes to the same symbol that
is "this.x"
Alias will create an alias for a symbol, not an expression or
the like.
So
obj.x
I'm debugging some code I wrote back in 2017 and a bounding box
collision detection kept giving spurious answers till I resorted
to assuming nothing and dumped every variable and alias.
I kept getting results like it was checking against itself, and
of course, that would result in finding a
On Friday, 1 May 2020 at 08:17:33 UTC, norm wrote:
On Friday, 1 May 2020 at 07:38:53 UTC, Chris Katko wrote:
[...]
You need to convert the sort output to dchar[], e.g.
---
dchar[] line3 = sort(line2.to!(dchar[])).to!(dchar[]);
---
Cheers,
Norm
That works, thanks!
I'm making anagrams. According to the nextPermutation() docs, I
need to 'sort by less' to get all permutations. ... Except the
doc page doesn't mention how to do that, nor does
std.algorithm.sort show how to sort a string. ... and the google
results on the dlang forums from 2017 don't work.
On Sunday, 12 January 2020 at 13:58:18 UTC, Per Nordlöw wrote:
Is there a druntime/phobos function for getting the amount of
memory (both, stack, malloc, and GC) being used by the current
process?
Valgrind will tell you the exact usage (except no delineation for
GC) per here:
On Wednesday, 8 January 2020 at 06:51:57 UTC, H. S. Teoh wrote:
On Wed, Jan 08, 2020 at 04:40:02AM +, Guillaume Lathoud via
Digitalmars-d-learn wrote:
[...]
[...]
Generally, the recommendation is to separately compile each
package. E.g., if you have a source tree of the form:
Thanks everyone, looks like i'll have to benchmark myself (which
is fine) but I'm always afraid because I know "proper
benchmarking is hard. (TM)"
Feel free to throw any other side advice in. I'm looking to get a
broad perspective on this.
Straight up shutting off the garbage collector in
When I program, it's usually videogame ideas. That implies a
soft, real-time requirement. In general, that requires the mantra
"allocations are evil, use object pools whenever possible."
[storing data in static arrays and 'deleting' is usually just
marking an entry as is_deleted=true and
You can drop this straight into run.dlang.io:
import std.stdio;
class base{ float x=1;}
class child : base {float x=2;} //shadows base variable!
void main()
{
base []array;
child c = new child;
array ~= c;
writeln(c.x); //=2
writeln(array[0].x); //=1 //uses BASE's
What's the easiest way to use POSIX and Linux-specific C include
files?
I know you can write a wrapper but it seems like half the time
these files include 20 files which include 20 files which use
strange enums, arrays, etc that don't clearly have answers on how
to wrap them.
Is there
On Saturday, 24 November 2018 at 20:44:57 UTC, welkam wrote:
On Friday, 23 November 2018 at 08:57:57 UTC, Chris Katko wrote:
D is supposed to compile fast.
You didnt read the fine print. It compiles simple code fast.
Also compilation is separate step from linking and your program
might
On Friday, 23 November 2018 at 10:00:17 UTC, Nicholas Wilson
wrote:
If you pass all the files on the command line then they all get
(re)compiled.
How are you supposed include files if not passing them to the
compiler?
I'm only using std.regex in one file, IIRC, so whatever the
"proper"
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), and I'm hitting
~15 seconds compile time in LDC and ~7 seconds in
Try to learn D.
Put writeln in deconstructor to prove it works as expected
Make random changes, program never runs again.
Takes 30+ minutes to realize that writeln("my string") is fine,
but writeln("my string " ~ value) is an allocation / garbage
collection which crashes the program without a
On Saturday, 10 November 2018 at 13:53:14 UTC, Kagamin wrote:
On Friday, 9 November 2018 at 09:11:37 UTC, Jonathan M Davis
wrote:
No, I didn't. I just used underscores, which has been used
with plain text for emphasis for decades. Supporting markdown,
would involve stuff like backticks for
On Friday, 9 November 2018 at 09:11:37 UTC, Jonathan M Davis
wrote:
On Friday, November 9, 2018 1:27:44 AM MST Kagamin via
Digitalmars-d-learn wrote:
On Friday, 9 November 2018 at 06:42:37 UTC, Jonathan M Davis
wrote:
> [...]
You used markdown three times in your message.
No, I didn't. I
Simple curious question.
Why isn't :
import std.stdio;
instead:
import std.io;
(Also, while we're at it. Why doesn't this form have code
highlighting? It would much improve readibility. Doesn't that
seem almost essential for a programming forum?)
I mean, I get it. stdio is the c header
On Wednesday, 17 October 2018 at 07:32:37 UTC, aliak wrote:
Hi,
Is there any notion of lazy vars in D (i see that there're
parameters)?
i.e:
struct S {
//...
int y;
//...
}
lazy S x = () {
// do some heavy stuff
}();
if (condition) {
func(x.y); // heavy stuff evaluated here
}
int [50]data;
foreach(i, datum; data){} // works
File file("gasdgasd");
foreach(i, line; file.byLine){} //NOPE.
foreach(line; file.byLine){} //works.
I finally noticed in the docs it says "for arrays only." The
question is, why?
Every language that I used previously (as far as I can
On Sunday, 14 October 2018 at 03:26:33 UTC, Adam D. Ruppe wrote:
On Sunday, 14 October 2018 at 03:07:59 UTC, Chris Katko wrote:
For comparison, I just tested and grep uses about 4 MB of RAM
to run.
Running and compiling are two entirely different things.
Running the D regex code should be
On Sunday, 14 October 2018 at 02:44:55 UTC, Chris Katko wrote:
On Friday, 12 October 2018 at 13:42:34 UTC, Alex wrote:
[...]
So wait, if their solution was to simply REMOVE std.regex from
isEmail. That doesn't solve the regex problem at all. And from
what I read in that thread, this penalty
On Friday, 12 October 2018 at 13:42:34 UTC, Alex wrote:
On Friday, 12 October 2018 at 13:25:33 UTC, Chris Katko wrote:
Like, insanely fat.
All I wanted was a simple regex. The second include a regex
function, my program would no longer compile "out of memory
for fork".
/usr/bin/time -v
Like, insanely fat.
All I wanted was a simple regex. The second include a regex
function, my program would no longer compile "out of memory for
fork".
/usr/bin/time -v reports it went from 150MB of RAM for D,
DAllegro, and Allegro5.
To over 650MB of RAM, and from 1.5 seconds to >5.5
On Wednesday, 10 October 2018 at 16:00:42 UTC, Steven
Schveighoffer wrote:
On 10/10/18 9:22 AM, Chris Katko wrote:
int[][] data =
[
[1, 0, 1, 0, 0],
[1, 0, 1, 0, 0],
[1, 0, 1, 1, 1],
[1, 0, 0, 1, 0],
[5, 1, 1, 1, 0]
];
when drawn with
int[][] data =
[
[1, 0, 1, 0, 0],
[1, 0, 1, 0, 0],
[1, 0, 1, 1, 1],
[1, 0, 0, 1, 0],
[5, 1, 1, 1, 0]
];
when drawn with data[i][j], prints the transpose of "data":
[1, 1, 1, 1, 5]
[0, 0, 0, 0, 1]
[1,
On Tuesday, 9 October 2018 at 10:52:47 UTC, Chris Katko wrote:
I have a 2-D array:
int[5][5] data =
[
[1, 0, 1, 0, 0],
[1, 0, 1, 0, 0],
[1, 0, 1, 1, 1],
[1, 0, 0, 1, 0],
[1, 1, 1, 1, 0]
];
1 - Is
I have a 2-D array:
int[5][5] data =
[
[1, 0, 1, 0, 0],
[1, 0, 1, 0, 0],
[1, 0, 1, 1, 1],
[1, 0, 0, 1, 0],
[1, 1, 1, 1, 0]
];
1 - Is there a way to foreach vertically through that? (that is,
On Thursday, 4 October 2018 at 08:52:28 UTC, Andrea Fontana wrote:
On Thursday, 4 October 2018 at 08:32:13 UTC, Chris Katko wrote:
I've been Google'ing and there's like... nothing out there.
One of the top results for "std.socket dlang examples"... is
for TANGO. That's how old it is.
Socket
I've been Google'ing and there's like... nothing out there.
One of the top results for "std.socket dlang examples"... is for
TANGO. That's how old it is.
On Wednesday, 3 October 2018 at 11:51:01 UTC, Sebastiaan Koppe
wrote:
On Wednesday, 3 October 2018 at 11:01:53 UTC, Chris Katko wrote:
[...]
A combination of static introspection with string mixins does
the trick:
---
enum colors {
reset = "\033[0m",
red = "\033[31m"
}
auto
I've got this simple task but I'm trying to perfect it as best I
can to learn something in the process.
I have Linux terminal ASCII codes for coloring terminal output.
string red(string) { /* ... */ }
"Hello world".red => "\033[31mHello World\033[0m"
which translates to "[red]Hello
On Wednesday, 3 October 2018 at 00:34:33 UTC, Adam D. Ruppe wrote:
On Wednesday, 3 October 2018 at 00:14:03 UTC, Chris Katko wrote:
Except it doesn't work and tries to decode col.width-1 into a
hexadecimal number and only prints that. ("4D6EF6")
That number certainly isn't col.width (unless
- First, I'm confused. The docs say 's' is "whatever it needs to
be". ("he corresponding argument is formatted in a manner
consistent with its type:") But what if I specifically want a
STRING. Because I only see floats, ints, etc. No forced string
types.
- Second,
This works fine in D:
On Wednesday, 23 November 2016 at 08:47:56 UTC, Christian Köstlin
wrote:
On 03/03/2012 18:35, Timon Gehr wrote:
On 03/03/2012 12:09 PM, Nicolas Silva wrote:
[...]
Yes, this seems to be a bug.
Workaround:
struct Foo{
string s;
Tid id;
}
void foo(){
Foo foo;
On Monday, 24 September 2018 at 07:13:24 UTC, Chris Katko wrote:
On Monday, 24 September 2018 at 05:59:20 UTC, Chris Katko wrote:
[...]
Actually, I just realized/remembered that the error occurs
inside parallelism itself, and MANY times at that:
[...]
This JUST occurred to me.
On Monday, 24 September 2018 at 05:59:20 UTC, Chris Katko wrote:
On Saturday, 22 September 2018 at 02:26:41 UTC, Chris Katko
wrote:
On Saturday, 22 September 2018 at 02:13:58 UTC, Chris Katko
wrote:
On Friday, 21 September 2018 at 12:15:59 UTC, Ali Çehreli
wrote:
On 09/21/2018 12:25 AM, Chris
On Saturday, 22 September 2018 at 02:26:41 UTC, Chris Katko wrote:
On Saturday, 22 September 2018 at 02:13:58 UTC, Chris Katko
wrote:
On Friday, 21 September 2018 at 12:15:59 UTC, Ali Çehreli
wrote:
On 09/21/2018 12:25 AM, Chris Katko wrote:
[...]
You can use a free-standing function as a
On Saturday, 22 September 2018 at 02:13:58 UTC, Chris Katko wrote:
On Friday, 21 September 2018 at 12:15:59 UTC, Ali Çehreli wrote:
On 09/21/2018 12:25 AM, Chris Katko wrote:
[...]
You can use a free-standing function as a workaround, which is
included in the following chapter that explains
On Friday, 21 September 2018 at 12:15:59 UTC, Ali Çehreli wrote:
On 09/21/2018 12:25 AM, Chris Katko wrote:
On Thursday, 20 September 2018 at 05:51:17 UTC, Neia Neutuladh
wrote:
On Thursday, 20 September 2018 at 05:34:42 UTC, Chris Katko
wrote:
All I want to do is loop from 0 to [constant]
On Thursday, 20 September 2018 at 05:51:17 UTC, Neia Neutuladh
wrote:
On Thursday, 20 September 2018 at 05:34:42 UTC, Chris Katko
wrote:
All I want to do is loop from 0 to [constant] with a for or
foreach, and have it split up across however many cores I have.
You're looking at
All I want to do is loop from 0 to [constant] with a for or
foreach, and have it split up across however many cores I have.
ulong sum;
foreach(i; [0 to 1 trillion])
{
//flip some dice using
float die_value = uniform(0F,12F);
if(die_value > [constant]) sum++;
On Monday, 3 September 2018 at 07:38:51 UTC, Chris Katko wrote:
On Monday, 3 September 2018 at 06:28:38 UTC, bauss wrote:
On Monday, 3 September 2018 at 06:25:23 UTC, bauss wrote:
On Monday, 3 September 2018 at 03:19:39 UTC, Neia Neutuladh
wrote:
On Monday, 3 September 2018 at 03:04:57 UTC,
On Monday, 3 September 2018 at 06:28:38 UTC, bauss wrote:
On Monday, 3 September 2018 at 06:25:23 UTC, bauss wrote:
On Monday, 3 September 2018 at 03:19:39 UTC, Neia Neutuladh
wrote:
On Monday, 3 September 2018 at 03:04:57 UTC, Chris Katko
wrote:
This should be simple? All I want to do is load
On Monday, 3 September 2018 at 03:19:39 UTC, Neia Neutuladh wrote:
On Monday, 3 September 2018 at 03:04:57 UTC, Chris Katko wrote:
This should be simple? All I want to do is load an entire
file, and access individual bytes. The entire thing. I don't
want to have know the file size before hand,
This should be simple? All I want to do is load an entire file,
and access individual bytes. The entire thing. I don't want to
have know the file size before hand, or "guess" and have a
"maximum size" buffer.
So far, all google searches for "dlang binary file read" end up
not working for me.
Oh goodness. I thought D was using Doxygen!
Thanks.
I'm a complete doxygen newbie. But my first thought when writing
comments is... why not use Markdown? (Which has become almost
universal online these days.)
So I google it and Moxygen comes up. Which seems pretty good.
On Wednesday, 18 April 2018 at 07:15:47 UTC, Simen Kjærås wrote:
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
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 %)\n%)", data));
That was all pseudo-code typed by hand.
I got my code to work today. I don't know if it's the prettiest
it can be, but it works:
// TESTING ACCESS TO the OWNING function
//---
class test_window
{
float x;
float y;
I'm having trouble conceptualizing this issue at the moment. But
it seems if I pass to the delegate my object, then I can ONLY use
one class type.
Say, the delegate takes a "this" from... some class that wants to
have a dialog. A window. Now the delegate NEEDS a this from a
window, and only
1 - 100 of 135 matches
Mail list logo