When replace typedef to enum, it became impossible to compile a certain
portion.
dmd v2.057 Windows
enum HANDLE : void* {init = (void*).init}
pure HANDLE int_to_HANDLE(int x)
{
return cast(HANDLE)x;
}
void bar()
{
HANDLE a = cast(HANDLE)1;//
Is there a plan to replace streams with byte ranges? Or should I just
use streams?
I need to do some binary parsing and I found using ranges is not very
comfortable. For example to read an uint I need to:
version (LittleEndian)
auto r = retro(takeExactly(range, 4));
else
auto r =
I need a fast way to append to an SList. I was thinking of using insertAfter()
and keep track of a range that points to the end of the list but, after
appending an item, how would you get the new range to the end?
This is what I had planned:
List!int list;
Range end = list[];
On Friday, January 13, 2012 12:17:06 Piotr Szturmaj wrote:
Is there a plan to replace streams with byte ranges? Or should I just
use streams?
At some point, std.stream will be replace with a range-based API. There has
been some discussion on the design, but it hasn't been fully fleshed out,
H. S. Teoh:
void opApply(int delegate(ref uint n) cb) const {
Use const ref:
void opApply(int delegate(const ref uint n) cb) const {
Bye,
bearophile
On 13/01/12 10:01, k2 wrote:
When replace typedef to enum, it became impossible to compile a certain
portion.
dmd v2.057 Windows
enum HANDLE : void* {init = (void*).init}
pure HANDLE int_to_HANDLE(int x)
{
return cast(HANDLE)x;
}
Don Clugston wrote:
On 13/01/12 10:01, k2 wrote:
When replace typedef to enum, it became impossible to compile a certain
portion.
dmd v2.057 Windows
enum HANDLE : void* {init = (void*).init}
pure HANDLE int_to_HANDLE(int x)
{
return
Jonathan M Davis wrote:
On Friday, January 13, 2012 12:17:06 Piotr Szturmaj wrote:
Is there a plan to replace streams with byte ranges? Or should I just
use streams?
At some point, std.stream will be replace with a range-based API. There has
been some discussion on the design, but it hasn't
On Fri, 13 Jan 2012 06:34:39 -0500, Fernando Carvajal
fernandocarva...@mailinator.com wrote:
I need a fast way to append to an SList. I was thinking of using
insertAfter()
and keep track of a range that points to the end of the list but, after
appending an item, how would you get the new
On Fri, Jan 13, 2012 at 07:36:40AM -0500, bearophile wrote:
H. S. Teoh:
void opApply(int delegate(ref uint n) cb) const {
Use const ref:
void opApply(int delegate(const ref uint n) cb) const {
[...]
Thanks a lot! That works like a charm!
T
--
Let's not fight disease by
On Thu, 12 Jan 2012 22:49:49 -0500, H. S. Teoh hst...@quickfur.ath.cx
wrote:
Hi all,
I'm experimenting with overloading foreach() with opApply, and I found
that this code doesn't compile:
class C {
void opApply(int delegate(uint n) cb) const {
I'm currently fiddling around with some stuff, and I was curious
how well thousands of threads run simultaneously.
The problem now is, that I'm often running into the following
exception:
core.thread.ThreadException@src\core\thread.d(817): Error
creating thread
Here's my test program:
On Fri, Jan 13, 2012 at 08:42:51PM +0100, exec wrote:
I'm currently fiddling around with some stuff, and I was curious how
well thousands of threads run simultaneously.
The problem now is, that I'm often running into the following
exception:
core.thread.ThreadException@src\core\thread.d(817):
On Friday, January 13, 2012 11:52:00 H. S. Teoh wrote:
On Fri, Jan 13, 2012 at 08:42:51PM +0100, exec wrote:
I'm currently fiddling around with some stuff, and I was curious how
well thousands of threads run simultaneously.
The problem now is, that I'm often running into the following
Why does the following code compile?
import std.stdio;
int f(ref int x) {
return x++;
}
class A {
int x=123;
int g() const {
return f(x);
}
}
void main() {
On Fri, 13 Jan 2012 15:27:56 -0500, H. S. Teoh hst...@quickfur.ath.cx
wrote:
Why does the following code compile?
import std.stdio;
int f(ref int x) {
return x++;
}
class A {
int x=123;
int g() const {
On Friday, 13 January 2012 at 20:02:21 UTC, Jonathan M Davis
wrote:
Yeah. You can have user-defined limits too. IIRC, on Linux, the
default thread limit per user is 1024 threads, whereas the
system limit is over 60,000. The limits can be tweaked if you
need to though. I assume that the
My first question si very silly:
string str = readln()
my input is for example 123
how can i convert this to an integer?
Thanks.
Jorge wrote:
My first question si very silly:
string str = readln()
my input is for example 123
how can i convert this to an integer?
import std.conv;
// then in code:
auto i = to!int(str);
[Cross-posted with D.announce, since it's also an annoucement]
Hello all,
I discovered D a few years ago and, seeing the recent increase in community
projects, I
looked for a way to bring my own small part to it.
I quite like D templates and wanted to try LaTeX again, so I decided to bite
the
Am 13.01.2012 22:16, Piotr Szturmaj wrote:
Jorge wrote:
My first question si very silly:
string str = readln()
my input is for example 123
how can i convert this to an integer?
import std.conv;
// then in code:
auto i = to!int(str);
the string returned by readln() ends with NL ('\n'),
Ok, it works fine. Thx to you all ;-) and sorry for my noob question.
You could also try to!int(str.strip), strip() removes
whitespace from the left and right of a string.
You have to import std.string for it.
On 13 January 2012 22:34, Joshua Reusch yos...@arkandos.de wrote:
Am 13.01.2012 22:16, Piotr Szturmaj wrote:
Jorge wrote:
My first question si very
On 01/13/2012 10:34 PM, Jorge wrote:
Thanks for your answer but:
import std.stdio;
import std.conv;
void main()
{
write(Insert number: );
string s = readln();
auto i = to!int(s);
}
compiles but after i enter a number and press the enter key i get:
Timon Gehr:
readln() includes the trailing newline character in the resulting
string. You can use std.string.strip to remove leading and trailing
whitespace:
Time ago I have asked Andrei to modify the to!int conversion to work as Python,
ignoring leading and trailing whitespace:
s =
While we're at it: what's the best way to parse in a formatted manner?
For example, if I want to get 5 hexadecimal digits converted into an
uint? And I want to simultaneously advance the string?
sscanf seems fiddly and unsafe.
On 13 January 2012 22:56, bearophile bearophileh...@lycos.com wrote:
I can't understand it. Why would someone need template programming. What
problem does template solve?
--
D
On 13/01/12 10:48 PM, DNewbie wrote:
I can't understand it. Why would someone need template programming. What
problem does template solve?
Suppose you want to write a function to get the minimum of two integers.
It's easy:
int min(int a, int b)
{
return a b ? a : b;
}
Suppose then
On Fri, Jan 13, 2012, at 11:28 PM, Peter Alexander wrote:
On 13/01/12 10:48 PM, DNewbie wrote:
I can't understand it. Why would someone need template programming. What
problem does template solve?
Suppose you want to write a function to get the minimum of two integers.
It's easy:
On 01/13/2012 02:48 PM, DNewbie wrote:
I can't understand it. Why would someone need template programming. What
problem does template solve?
Here is another resource that tries to answer that question:
http://ddili.org/ders/d.en/templates.html
Parts of the source code may be left to the
On Fri, Jan 13, 2012 at 11:05:19PM +0100, Matej Nanut wrote:
While we're at it: what's the best way to parse in a formatted manner?
For example, if I want to get 5 hexadecimal digits converted into an
uint?
[...]
Have you tried:
import std.conv;
...
uint val =
On Fri, 13 Jan 2012 23:05:19 +0100, Matej Nanut wrote:
While we're at it: what's the best way to parse in a formatted manner?
For example, if I want to get 5 hexadecimal digits converted into an
uint? And I want to simultaneously advance the string?
sscanf seems fiddly and unsafe.
Check
Hi all,
I'm reading the docs for startsWith(A,B...) with multiple ranges in B,
and it seems that it will always match the *shortest* range whenever
more than one range in B matches. Is there a way to make it always match
the *longest* range instead? Or do I have to write my own function for
that?
On Friday, January 13, 2012 16:48:00 H. S. Teoh wrote:
Hi all,
I'm reading the docs for startsWith(A,B...) with multiple ranges in B,
and it seems that it will always match the *shortest* range whenever
more than one range in B matches. Is there a way to make it always match
the *longest*
On Fri, Jan 13, 2012 at 09:36:07PM -0500, Jonathan M Davis wrote:
On Friday, January 13, 2012 16:48:00 H. S. Teoh wrote:
Hi all,
I'm reading the docs for startsWith(A,B...) with multiple ranges in B,
and it seems that it will always match the *shortest* range whenever
more than one
I've been trying to translate the following from
http://www.scintilla.org/Steps.html
int (*fn)(void*,int,int,int);
void * ptr;
int canundo;
fn = (int (__cdecl *)(void *,int,int,int))SendMessage(
hwndScintilla,SCI_GETDIRECTFUNCTION,0,0);
ptr = (void
You can clone this: g...@github.com:AndrejMitrovic/DSciteWin.git
Then just run build.bat.
On 1/14/12, Andrej Mitrovic andrej.mitrov...@gmail.com wrote:
You can clone this: g...@github.com:AndrejMitrovic/DSciteWin.git
Then just run build.bat.
Sorry, I've assumed you run git, the http link is:
https://github.com/AndrejMitrovic/DSciteWin
On Sat, Jan 14, 2012, at 06:04 AM, Andrej Mitrovic wrote:
On 1/14/12, Andrej Mitrovic andrej.mitrov...@gmail.com wrote:
You can clone this: g...@github.com:AndrejMitrovic/DSciteWin.git
Then just run build.bat.
Sorry, I've assumed you run git, the http link is:
Your problem was that you didn't cast the function pointer to an
extern(C) function. Unfortunately you can't do this inline (I can't
tell if this will be fixed or not), so you have to use an alias as a
workaround:
alias extern (C) int function(void*,int,int,int) SciFnDirect;
fn =
On Friday, January 13, 2012 18:47:19 H. S. Teoh wrote:
On Fri, Jan 13, 2012 at 09:36:07PM -0500, Jonathan M Davis wrote:
On Friday, January 13, 2012 16:48:00 H. S. Teoh wrote:
Hi all,
I'm reading the docs for startsWith(A,B...) with multiple ranges in
B,
and it seems that it
41 matches
Mail list logo