Hi,everyone,
Now,I use some code in strsafe.h,but where can get the strsafe.d ?
Thanks.
On Tuesday, 20 February 2018 at 08:50:27 UTC, Jonathan M Davis
wrote:
On Tuesday, February 20, 2018 08:44:37 aberba via
Digitalmars-d-learn wrote:
On Sunday, 18 February 2018 at 15:23:14 UTC, Cym13 wrote:
> On Sunday, 18 February 2018 at 14:48:59 UTC, Cym13 wrote:
>> [...]
>
> Just thought of a
On Saturday, 24 February 2018 at 08:59:46 UTC, Domain wrote:
On Saturday, 24 February 2018 at 07:51:27 UTC, Domain wrote:
[...]
And why this not compile:
rows.each!(a => data ~= a.split(",").map!(b =>
b.strip).padRight("", 2));
Error: cannot deduce function from argument types
On Saturday, 24 February 2018 at 09:48:13 UTC, Joel wrote:
I'm trying some code for practice, but it isn't working
properly - it prints just one number when printing in reverse.
I think the problem is here:
void popFront() { head = head.next; if (head !is null)
head.prev = null; }
void
On Saturday, 24 February 2018 at 07:51:27 UTC, Domain wrote:
I want to convert a string like " a,b1, 23 " to
a 2D array like:
[["a", "b"],
["1", "2"],
["3", "" ]]
auto html = " a,b1, 23 ";
auto rows = html.strip.chomp("").split("");
string[][] data;
rows.each!(a => data ~= a.split(","));
I'm trying some code for practice, but it isn't working properly
- it prints just one number when printing in reverse.
'''
void main() {
import std.stdio, std.algorithm, std.range, std.conv;
struct List(T) {
class Node {
T value;
On Saturday, 24 February 2018 at 13:50:16 UTC, FrankLike wrote:
#define IOCTL_NDIS_QUERY_GLOBAL_STATS _NDIS_CONTROL_CODE(0,
METHOD_OUT_DIRECT)
use alias or enum,how to do?
neither. those are little functions.
auto IOCTL_NDIS_QUERY_GLOBAL_STATS () {
return _NDIS_CONTROL_CODE(0,
On Saturday, 24 February 2018 at 13:57:27 UTC, Adam D. Ruppe
wrote:
On Saturday, 24 February 2018 at 13:50:16 UTC, FrankLike wrote:
#define IOCTL_NDIS_QUERY_GLOBAL_STATS _NDIS_CONTROL_CODE(0,
METHOD_OUT_DIRECT)
auto IOCTL_NDIS_QUERY_GLOBAL_STATS () {
return _NDIS_CONTROL_CODE(0,
On Saturday, 24 February 2018 at 09:06:09 UTC, Domain wrote:
On Saturday, 24 February 2018 at 08:59:46 UTC, Domain wrote:
On Saturday, 24 February 2018 at 07:51:27 UTC, Domain wrote:
[...]
And why this not compile:
rows.each!(a => data ~= a.split(",").map!(b =>
b.strip).padRight("", 2));
On 02/24/2018 11:26 AM, TheFlyingFiddle wrote:
On Saturday, 24 February 2018 at 09:48:13 UTC, Joel wrote:
[...]
void popFront() { head = head.next; if (head !is null) head.prev =
null; }
void popBack() { tail = tail.prev; if (tail !is null) tail.next = null; }
Head and tail will point to
On Saturday, 24 February 2018 at 09:48:13 UTC, Joel wrote:
I'm trying some code for practice, but it isn't working
properly - it prints just one number when printing in reverse.
[...]
the first writeln destroys the range via popFront, I think. As if
you comment it out, the writeln with
Hi,everyone,
I can convert some simple C macros, but a bit more complicated
will need your help.
For example:
#define _NDIS_CONTROL_CODE(request,method) \
CTL_CODE(FILE_DEVICE_PHYSICAL_NETCARD, request,
method, FILE_ANY_ACCESS)
#define IOCTL_NDIS_QUERY_GLOBAL_STATS
On Friday, 23 February 2018 at 23:11:13 UTC, aberba wrote:
I recently noticed vibe.d now using main loop which call the
vibe.d event loop. Why that change?
I can only assume it's because static constructors are a pain in
the ass.
https://dlang.org/spec/module.html#order_of_static_ctor
I don't get the point of the deprecation message:
--- intprom.d
import std.stdio;
void main ()
{
short s, t;
t = -s;
}
---
$ dmd intprom.d
intprom.d(6): Deprecation: integral promotion not done for -s,
use '-transition=intpromote' switch or -cast(int)(s)
What shall I do in order to
On 2/24/18 3:07 PM, kdevel wrote:
I don't get the point of the deprecation message:
--- intprom.d
import std.stdio;
void main ()
{
short s, t;
t = -s;
}
---
https://dlang.org/changelog/2.078.0.html#fix16997
$ dmd intprom.d
intprom.d(6): Deprecation: integral promotion not done for
On Saturday, 24 February 2018 at 20:17:12 UTC, Steven
Schveighoffer wrote:
On 2/24/18 3:07 PM, kdevel wrote:
I don't get the point of the deprecation message:
--- intprom.d
import std.stdio;
void main ()
{
short s, t;
t = -s;
}
---
https://dlang.org/changelog/2.078.0.html#fix16997
I want to use formattedRead to enforce a certain format, and easily
parse out the data from a string.
But if I do:
string s = "123:abc:123";
string y;
assert(s.formattedRead!"123:%s:123"(y) == 1);
y is now a newly-allocated string, not a slice of the input. In the case
of parsing strings
On Saturday, 24 February 2018 at 14:58:52 UTC, FrankLike wrote:
Hi,everyone,
Now,I use some code in strsafe.h,but where can get the
strsafe.d ?
Thanks.
Basically nowhere.
strsafe.h is non-standard.
What you have to do is create the binding yourself.
On 2/24/18 4:42 PM, kdevel wrote:
On Saturday, 24 February 2018 at 20:17:12 UTC, Steven Schveighoffer wrote:
https://dlang.org/changelog/2.078.0.html#fix16997
My goodness! So there is currently no negation operator defined on short
and some other types?
No, that's not the case. It's simply
On Saturday, 24 February 2018 at 22:30:09 UTC, Steven
Schveighoffer wrote:
The prime example is this:
byte b = -128;
int x = -b;
What would you expect x to be?
a) 128
b) -128
Neither nor. I would prefer the codomain of "-" be the range of
byte
and hence an exception thrown in that
On Saturday, 24 February 2018 at 20:07:04 UTC, kdevel wrote:
I don't get the point of the deprecation message:
--- intprom.d
import std.stdio;
void main ()
{
short s, t;
t = -s;
}
---
$ dmd intprom.d
intprom.d(6): Deprecation: integral promotion not done for -s,
use
A code fragment using static foreach
https://forum.dlang.org/thread/jiefcxwqbjzqnmtaz...@forum.dlang.org#post-beruryblsptnunsowjph:40forum.dlang.org
does not compile with the current GDC (GCC 4.9.4 and 5.5.0). I
tried to encapsulate this code into a version block but GDC still
checks the
On Sunday, 25 February 2018 at 00:36:16 UTC, kdevel wrote:
A code fragment using static foreach
https://forum.dlang.org/thread/jiefcxwqbjzqnmtaz...@forum.dlang.org#post-beruryblsptnunsowjph:40forum.dlang.org
does not compile with the current GDC (GCC 4.9.4 and 5.5.0). I
tried to encapsulate
On Sunday, February 25, 2018 00:36:16 kdevel via Digitalmars-d-learn wrote:
> A code fragment using static foreach
>
> https://forum.dlang.org/thread/jiefcxwqbjzqnmtaz...@forum.dlang.org#post-b
> eruryblsptnunsowjph:40forum.dlang.org
>
> does not compile with the current GDC (GCC 4.9.4 and 5.5.0).
On Sunday, 25 February 2018 at 00:42:20 UTC, Seb wrote:
On Sunday, 25 February 2018 at 00:36:16 UTC, kdevel wrote:
[...]
Are you looking for something like this?
---
static if (__traits(compiles, () { static foreach (i; [0]){} }))
version = supportsStaticForeach;
void main()
{
On Sunday, 25 February 2018 at 05:24:54 UTC, psychoticRabbit
wrote:
Hi. Anyone know whether something like this is possible?
I've tried various conversions/casts, but no luck yet.
Essentially, I want to cast the result set of the iota to an
array, during initialisation of the variable.
You
On Sunday, February 25, 2018 02:58:33 Seb via Digitalmars-d-learn wrote:
> On Sunday, 25 February 2018 at 02:37:00 UTC, Jonathan M Davis
>
> wrote:
> > If any exceptions could be thrown, then a lazy solution can't
> > be @nogc (something that's often the case with strings thanks
> > to
On Tuesday, 20 February 2018 at 08:44:37 UTC, aberba wrote:
On Sunday, 18 February 2018 at 15:23:14 UTC, Cym13 wrote:
On Sunday, 18 February 2018 at 14:48:59 UTC, Cym13 wrote:
[...]
Just thought of a much better/simpler solution for that last
case that also doesn't force you to read all
On Sunday, February 25, 2018 01:49:05 Seb via Digitalmars-d-learn wrote:
> On Tuesday, 20 February 2018 at 08:44:37 UTC, aberba wrote:
> > On Sunday, 18 February 2018 at 15:23:14 UTC, Cym13 wrote:
> >> On Sunday, 18 February 2018 at 14:48:59 UTC, Cym13 wrote:
> >>> [...]
> >>
> >> Just thought of
On Sunday, 25 February 2018 at 02:37:00 UTC, Jonathan M Davis
wrote:
If any exceptions could be thrown, then a lazy solution can't
be @nogc (something that's often the case with strings thanks
to auto-decoding and UTFExceptions), and a solution could be
eager without allocating if the result
On Friday, 23 February 2018 at 23:11:13 UTC, aberba wrote:
I recently noticed vibe.d now using main loop which call the
vibe.d event loop.
"Recently"?
FWIW this has been phased out a long time ago ;-)
---
0.7.23 (2015)
Definition of either VibeCustomMain or VibeDefaultMain is now a
hard
On Saturday, 24 February 2018 at 03:04:07 UTC, Adam D. Ruppe
wrote:
On Saturday, 24 February 2018 at 02:54:13 UTC, Jonathan wrote:
I am having trouble finding many useful explanations of using
template constraints beyond basic usage.
The constraint is just like static if as to what it allows
On Sunday, February 25, 2018 05:24:54 psychoticRabbit via Digitalmars-d-
learn wrote:
> Hi. Anyone know whether something like this is possible?
>
> I've tried various conversions/casts, but no luck yet.
>
> Essentially, I want to cast the result set of the iota to an
> array, during
On Sunday, 25 February 2018 at 06:22:03 UTC, psychoticRabbit
wrote:
On Sunday, 25 February 2018 at 05:40:19 UTC, Jonathan M Davis
wrote:
int[] intArr = iota(1, 11).array();
- Jonathan M Davis
thanks!
oh man. It's so easy to do stuff in D ;-)
But this leads me to a new problem now.
On Sunday, February 25, 2018 06:22:03 psychoticRabbit via Digitalmars-d-
learn wrote:
> On Sunday, 25 February 2018 at 05:40:19 UTC, Jonathan M Davis
>
> wrote:
> > int[] intArr = iota(1, 11).array();
> >
> > - Jonathan M Davis
>
> thanks!
>
> oh man. It's so easy to do stuff in D ;-)
>
> But
On Sunday, 25 February 2018 at 01:19:02 UTC, Seb wrote:
On Sunday, 25 February 2018 at 00:42:20 UTC, Seb wrote:
On Sunday, 25 February 2018 at 00:36:16 UTC, kdevel wrote:
[...]
Are you looking for something like this?
---
static if (__traits(compiles, () { static foreach (i; [0]){}
}))
On Sun, Feb 25, 2018 at 06:22:03AM +, psychoticRabbit via
Digitalmars-d-learn wrote:
[..]
> printArray(doubleArr); // why is it printing ints instead of doubles??
[...]
> void printArray(T)(const ref T[] a) if (isArray!(T[]))
> {
> foreach(t; a)
> writeln(t);
Try:
Hi. Anyone know whether something like this is possible?
I've tried various conversions/casts, but no luck yet.
Essentially, I want to cast the result set of the iota to an
array, during initialisation of the variable.
no, I don't want to use 'auto'. I want an array object ;-)
On Sunday, 25 February 2018 at 05:40:19 UTC, Jonathan M Davis
wrote:
int[] intArr = iota(1, 11).array();
- Jonathan M Davis
thanks!
oh man. It's so easy to do stuff in D ;-)
But this leads me to a new problem now.
When I run my code below, I get ints printed instead of doubles??
On Saturday, 24 February 2018 at 09:48:13 UTC, Joel wrote:
I'm trying some code for practice, but it isn't working
properly - it prints just one number when printing in reverse.
[snip]
Thanks guys. And I got it working with 'if (head is tail)' etc.
40 matches
Mail list logo