On 16/09/14 02:06, AsmMan wrote:
Neither assert or return will help. Check out this code example:
void main() {
f();
}
void f() {
if(!foo)
exit(1);
do_something();
}
If you want to exit the application with exit code 1 then it sounds like
something has gone wrong. In that case,
On Tuesday, 16 September 2014 at 03:05:57 UTC, Franz wrote:
On Tuesday, 16 September 2014 at 03:03:16 UTC, Franz wrote:
On Tuesday, 16 September 2014 at 02:21:42 UTC, rcor wrote:
I'm back for another round of is this a bug, or am I doing
something stupid?.
C and D implement interface I, and
How generate documentation for phobos PR?
On Tuesday, 16 September 2014 at 06:27:59 UTC, Klaus wrote:
On Tuesday, 16 September 2014 at 03:05:57 UTC, Franz wrote:
On Tuesday, 16 September 2014 at 03:03:16 UTC, Franz wrote:
On Tuesday, 16 September 2014 at 02:21:42 UTC, rcor wrote:
I'm back for another round of is this a bug, or am I
On Tuesday, 16 September 2014 at 08:39:43 UTC, Marc Schütz wrote:
AFACIS there's nothing wrong with his use of casting. It's fine
here, because `I` is a base type of `C` and `D`. If it weren't
for the arrays, the cast wouldn't even be necessary. I think
it's a bug.
Correction:
AFAIK casting
On Tuesday, 16 September 2014 at 01:16:14 UTC, Adam D. Ruppe
wrote:
bool function(T val1,T val2) ptr=comp!T;
Moreover, comp has compile time arguments, so you can't take
the address of it without forwarding the arguments. So instead
of comp, you use comp!T - passing the T from the outside
On Tuesday, 16 September 2014 at 08:49:04 UTC, Marc Schütz wrote:
On Tuesday, 16 September 2014 at 08:39:43 UTC, Marc Schütz
wrote:
Whether the compiler should accept that or not is a different
question. I guess it should, because if it doesn't, there
wouldn't be an easy way to achieve a
On Tuesday, 16 September 2014 at 08:26:57 UTC, Ilya Yaroshenko
wrote:
How generate documentation for phobos PR?
http://wiki.dlang.org/Building_DMD has a section called building
the docs. I properly missed something while writing that, but it
is good starting point and the rest you will find
On Tuesday, 16 September 2014 at 06:27:59 UTC, Klaus wrote:
is just a horrible way of shortcuting the static typing. You
write this thinking that i has to be... and then you complain
latter because the cast does not work.
D is a strongly typed lang. in your example you use auto
because your
Why not static if(__ctfe) ?
On Tuesday, 16 September 2014 at 13:11:50 UTC, Ilya Yaroshenko
wrote:
Why not static if(__ctfe) ?
ctfe is a runtime condition. The function has the same code when
run at compile time, it is just being run in a different
environment.
On Tuesday, 16 September 2014 at 11:26:05 UTC, rcor wrote:
On Tuesday, 16 September 2014 at 08:49:04 UTC, Marc Schütz
wrote:
On Tuesday, 16 September 2014 at 08:39:43 UTC, Marc Schütz
wrote:
Whether the compiler should accept that or not is a different
question. I guess it should, because
On Tuesday, 16 September 2014 at 13:28:17 UTC, Rene Zwanenburg
wrote:
On Tuesday, 16 September 2014 at 13:17:28 UTC, Adam D. Ruppe
wrote:
On Tuesday, 16 September 2014 at 13:11:50 UTC, Ilya Yaroshenko
wrote:
Why not static if(__ctfe) ?
ctfe is a runtime condition. The function has the same
all the functions/methods i've come across so far deal with
either streams or just file names (like std.file.read) and there
doesn't seem to be a way to wrap a std.stdio.File in a stream (or
is there?). i need a function that takes a std.stdio.File and
returns a string or byte array.
On Tuesday, 16 September 2014 at 14:37:06 UTC, Jay wrote:
all the functions/methods i've come across so far deal with
either streams or just file names (like std.file.read) and
there doesn't seem to be a way to wrap a std.stdio.File in a
stream (or is there?). i need a function that takes a
V Tue, 16 Sep 2014 14:37:05 +
Jay via Digitalmars-d-learn digitalmars-d-learn@puremagic.com napsáno:
all the functions/methods i've come across so far deal with
either streams or just file names (like std.file.read) and there
doesn't seem to be a way to wrap a std.stdio.File in a stream
On Tuesday, 16 September 2014 at 14:43:10 UTC, Marc Schütz wrote:
You could try `std.mmfile.MmFile`, it has a constructor that
takes a `File`, but only on Linux:
http://dlang.org/phobos/std_mmfile.html
https://github.com/D-Programming-Language/phobos/blob/master/std/mmfile.d#L77-L79
does it
On Tuesday, 16 September 2014 at 14:49:08 UTC, Daniel Kozak via
Digitalmars-d-learn wrote:
You can use rawRead:
http://dlang.org/phobos/std_stdio.html#.File.rawRead
for that i need to know the size of the contents. is there a
function that does that for me? i'm looking for something like
On Tuesday, 16 September 2014 at 15:03:05 UTC, Jay wrote:
and it shouldn't matter whether the File instance represents a
regular file or a pipe/stream.
i meant pipe/socket.
Here's the setup, I have a function
void main { ... }
The main method parses input (via std.getopt) and calls one of
three void-return-type functions. The program's three options
correspond to significantly different initialization options.
In the code we then have:
enum RunOpt
Jonathan:
This is not intended. Note that calling return; after
funi(...) makes everything work. However, it feels like I'm
doing something wrong here?
Try:
enum RunOpt { opt1, opt2, opt3 } // No semicolon here
final switch (option) with (RunOpt) {
case opt1: fun1(...); break;
On Tuesday, 16 September 2014 at 14:59:45 UTC, Jay wrote:
On Tuesday, 16 September 2014 at 14:43:10 UTC, Marc Schütz
wrote:
You could try `std.mmfile.MmFile`, it has a constructor that
takes a `File`, but only on Linux:
http://dlang.org/phobos/std_mmfile.html
The following code does not compile, because the custom predicate
of std.algorithm.sort is a template parameter, and therefore can
only be a function, but not a delegate. In C++, there is a
variant of sort taking a function-object as a second (run-time)
parameter, but phobos does not seems to
On Tue, 16 Sep 2014 16:19:10 +, Simon Bürger wrote:
The following code does not compile, because the custom predicate of
std.algorithm.sort is a template parameter, and therefore can only be a
function, but not a delegate. In C++, there is a variant of sort taking
a function-object as a
On Tue, Sep 16, 2014 at 04:19:10PM +, via Digitalmars-d-learn wrote:
The following code does not compile, because the custom predicate of
std.algorithm.sort is a template parameter, and therefore can only be
a function, but not a delegate.
What makes you think so? Template parameters
On Tuesday, 16 September 2014 at 16:27:46 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
On Tue, Sep 16, 2014 at 04:19:10PM +, via
Digitalmars-d-learn wrote:
The following code does not compile, because the custom
predicate of
std.algorithm.sort is a template parameter, and therefore can
On Monday, 15 September 2014 at 21:37:50 UTC, John Colvin wrote:
would this work for you? alias is the usual way of taking a
function as a template parameter.
mixin template EventListener(alias slot)
Ah, thanks for the help! That works great. :)
On 09/16/2014 07:37 AM, Jay wrote:
all the functions/methods i've come across so far deal with either
streams or just file names (like std.file.read) and there doesn't seem
to be a way to wrap a std.stdio.File in a stream (or is there?). i need
a function that takes a std.stdio.File and returns
On Tue, Sep 16, 2014 at 04:38:04PM +, via Digitalmars-d-learn wrote:
On Tuesday, 16 September 2014 at 16:27:46 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
On Tue, Sep 16, 2014 at 04:19:10PM +, via Digitalmars-d-learn wrote:
The following code does not compile, because the custom
Note. ╨а╤Г╤Б╨╗╨░╨╜ is a cyrillic word. That should not affect
because dub only displays so.
Try:
enum RunOpt { opt1, opt2, opt3 } // No semicolon here
final switch (option) with (RunOpt) {
case opt1: fun1(...); break;
case opt2: fun2(...); break;
case opt3: fun3(...); break;
}
Bye,
bearophile
My hero.
Thanks Adam you saved me from alot.Just one more question how can
I compare two arguments of type T.
On Tuesday, 16 September 2014 at 01:16:14 UTC, Adam D. Ruppe
wrote:
You can get the code to compile with two changes:
bool function(T)(T val1,T val2) ptr=comp;
should be:
bool function(T
Thanks its the right help at right time.
On Tuesday, 16 September 2014 at 09:13:38 UTC, evilrat wrote:
On Tuesday, 16 September 2014 at 01:16:14 UTC, Adam D. Ruppe
wrote:
bool function(T val1,T val2) ptr=comp!T;
Moreover, comp has compile time arguments, so you can't take
the address of it
Thankx
On Tuesday, 16 September 2014 at 01:21:57 UTC, ketmar via
Digitalmars-d-learn wrote:
On Tue, 16 Sep 2014 01:09:27 +
amparacha via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com
wrote:
first change:
bool function(T)(T val1,T val2) ptr=comp;
to
auto ptr = comp!T;
second
On Tuesday, 16 September 2014 at 17:32:02 UTC, amparacha wrote:
Thanks Adam you saved me from alot.Just one more question how
can
I compare two arguments of type T.
If you want to compare the values, just use them like regular
variables. If you want to compare the types, use:
static
On Tuesday, 16 September 2014 at 14:13:48 UTC, Marc Schütz wrote:
On Tuesday, 16 September 2014 at 11:26:05 UTC, rcor wrote:
Is to! creating a new array of pointers while cast isn't? This
isn't a performance critical section and it's not a huge
array, so I ask mostly out of curiosity.
Yes,
On Tuesday, 16 September 2014 at 16:54:17 UTC, Ali Çehreli wrote:
On 09/16/2014 07:37 AM, Jay wrote:
all the functions/methods i've come across so far deal with
either
streams or just file names (like std.file.read) and there
doesn't seem
to be a way to wrap a std.stdio.File in a stream (or is
On Tue, 16 Sep 2014 14:37:05 +, Jay wrote:
all the functions/methods i've come across so far deal with either
streams or just file names (like std.file.read) and there doesn't seem
to be a way to wrap a std.stdio.File in a stream (or is there?). i need
a function that takes a
Hey I have a quick question: Does D have it's own version of
makefiles or anything (preferably simpler)?
So instead of typing in PowerShell dmd file1.d file2.d
lib\foo.lib -Isrc\ . I could just type most of that into a
file and then just type dmd file.X
I've seen some people make really
On Tuesday, 16 September 2014 at 18:42:42 UTC, Justin Whear wrote:
The short answer is no. I usually use something like this:
// Lazy
auto stream = stdin.byChunk(4096).joiner();
You can make it eager by tacking a `.array` on the end.
Functions used
are from std.stdio,
On Tuesday, 16 September 2014 at 19:00:05 UTC, K.K. wrote:
Hey I have a quick question: Does D have it's own version of
makefiles or anything (preferably simpler)?
So instead of typing in PowerShell dmd file1.d file2.d
lib\foo.lib -Isrc\ . I could just type most of that into a
file and then
Thanks Ali.
As always, your examples and explanations are amazingly clear and
easy to understand.
On Monday, 15 September 2014 at 23:57:59 UTC, Ali Çehreli wrote:
You must make use of the returned value to slice your wstring.
Something like this (not compiled):
auto actualLength =
Thanks AsmMan,
Found
http://msdn.microsoft.com/en-us/library/windows/desktop/ms724432%28v=vs.85%29.aspx
and with your help, now understand :)
The syntax below prints a blank after my username, so the slice
seems a bit too long :O So my final solution looks like:
module main;
import
On Tuesday, 16 September 2014 at 19:26:29 UTC, Cliff wrote:
I want to say somewhere on the forums are some descriptions of
using CMake for this. Might try searching for that.
Yeah I just looked up the CMake thing. It definitely seems worth
playing with, though I'm not really sure how
On Tuesday, 16 September 2014 at 20:29:12 UTC, K.K. wrote:
On Tuesday, 16 September 2014 at 19:26:29 UTC, Cliff wrote:
I want to say somewhere on the forums are some descriptions of
using CMake for this. Might try searching for that.
Yeah I just looked up the CMake thing. It definitely seems
On Tuesday, 16 September 2014 at 20:31:33 UTC, Cliff wrote:
Out of curiosity, why are you not using dub (on the
command-line)?
I'm not against using it or anything, but I've found that it
didn't help me significantly nor did I have the patience to
figure out it's whole set of issues, D by
On Tuesday, 16 September 2014 at 20:45:29 UTC, K.K. wrote:
On Tuesday, 16 September 2014 at 20:31:33 UTC, Cliff wrote:
Out of curiosity, why are you not using dub (on the
command-line)?
I'm not against using it or anything, but I've found that it
didn't help me significantly nor did I have
On Tuesday, 16 September 2014 at 19:00:05 UTC, K.K. wrote:
Hey I have a quick question: Does D have it's own version of
makefiles or anything (preferably simpler)?
So instead of typing in PowerShell dmd file1.d file2.d
lib\foo.lib -Isrc\ . I could just type most of that into a
file and then
On Tuesday, 16 September 2014 at 20:53:08 UTC, Cliff wrote:
Would you be willing to provide some more detail on what about
it
you didn't like (errors, missing features, etc.)? I ask because
build systems are a particular interest of mine and I have
projects in this area which can always use
On Tuesday, 16 September 2014 at 20:57:20 UTC, Andrei Amatuni
wrote:
Have you tried - http://dlang.org/rdmd.html
only a tiny bit... I've haven't quite figured rdmd yet :\
I'm actually trying it out right now.
On Tuesday, 16 September 2014 at 21:05:18 UTC, K.K. wrote:
On Tuesday, 16 September 2014 at 20:53:08 UTC, Cliff wrote:
Would you be willing to provide some more detail on what about
it
you didn't like (errors, missing features, etc.)? I ask
because
build systems are a particular interest of
On Tuesday, 16 September 2014 at 21:17:19 UTC, Cliff wrote:
On Tuesday, 16 September 2014 at 21:05:18 UTC, K.K. wrote:
On Tuesday, 16 September 2014 at 20:53:08 UTC, Cliff wrote:
Would you be willing to provide some more detail on what
about it
you didn't like (errors, missing features, etc.)?
On Tuesday, 16 September 2014 at 20:31:33 UTC, Cliff wrote:
On Tuesday, 16 September 2014 at 20:29:12 UTC, K.K. wrote:
On Tuesday, 16 September 2014 at 19:26:29 UTC, Cliff wrote:
I want to say somewhere on the forums are some descriptions of
using CMake for this. Might try searching for that.
I have a use case that requires repeating performance
measurements of blocks of code that do not coincide with function
start and stop. For example, a function will be calling several
sub-operations, and I need to measure the execution from the
call statement until the execution of the
Hello,
I came back to D after a longer break and just wanted to set up a
small project to further get in contact with this language.
However, it seems that the codes which simply shall simulate a
deterministic finit automaton do not work correctly.
CODE ---
struct DeterministicState {
On 09/16/2014 09:08 PM, Robin wrote:
struct DeterministicState {
Structs are value types. When they are copied, the mutations that you
expect may be happening on a copy.
I don't understand what exactly should happen but the following changes
produce at least a different output. :)
1)
56 matches
Mail list logo