On Thursday, 8 June 2017 at 04:15:12 UTC, Stanislav Blinov wrote:
Earns you nothing? How about not performing an allocation and
copy?
Seen through the eyes of a complete beginner, this means
absolutely nothing. Those are the eyes I am using as I'm reading
a book and simply following the
OK, so I have narrowed down my SIGSEGV problem to having no real idea
how to do C function pointers in D code.
So I have a callback function that will be called from C library code.
It currently has signature:
extern(C) int checkFrontend(void* _arguments, dvb_v5_fe_parms*
On Wednesday, 7 June 2017 at 16:50:26 UTC, Russel Winder wrote:
In the constructor of an object to abstract the result of a
call to the C library code, the parameter is:
check_frontend_t* cf
You should remove the pointer here...
/Paolo
On Wednesday, June 07, 2017 07:43:06 ag0aep6g via Digitalmars-d-learn wrote:
> You understand the spec to say that because `foo.capacity` is 15 at one
> point, you should then be able to put 15 elements into `foo` without
> relocation. And what `bar` does in the meantime shouldn't matter.
>
> I
On Wednesday, 7 June 2017 at 14:58:26 UTC, drug wrote:
07.06.2017 16:27, Wulfklaue пишет:
Some of the dmd error messages need some tweaking.
import std.datetime;
auto t = Clock.currStdTime;
writeln(to!string(t));
Result in:
Error: template core.time.to cannot deduce function from
On Monday, 5 June 2017 at 16:30:53 UTC, Era Scarecrow wrote:
On Monday, 5 June 2017 at 16:04:28 UTC, ade90036 wrote:
Unfortunately the struct doesn't know at compile time what the
size of the constant_pool array, or at-least was not able to
specify it dynamically.
It also won't know ahead
On 06/07/2017 06:50 PM, Russel Winder via Digitalmars-d-learn wrote:
So why isn't a thing of type check_frontend_t*
AFAIK, you would usually translate:
typedef int (check_frontend_t*)(void *args, struct dvb_v5_fe_parms *parms);
into:
alias check_frontend_t = extern(C) int function (void*
07.06.2017 21:07, bachmeier пишет:
On Wednesday, 7 June 2017 at 14:58:26 UTC, drug wrote:
For me it's a good message.
Messages like this were an annoyance when I started out. If you don't
import std.stdio, you get the error message
Error: 'writeln' is not defined, perhaps you need to
On Thursday, 25 May 2017 at 17:56:12 UTC, jmh530 wrote:
On Thursday, 25 May 2017 at 16:36:45 UTC, jmh530 wrote:
[snip]
I haven't played around with it fully, but it seems like the
following resolves my issue in a sort of manual way:
template Process1(A, B)
{
static if (!isIndex!B)
On Wed, Jun 07, 2017 at 06:24:22PM +, ade90036 via Digitalmars-d-learn
wrote:
> On Monday, 5 June 2017 at 16:30:53 UTC, Era Scarecrow wrote:
> > On Monday, 5 June 2017 at 16:04:28 UTC, ade90036 wrote:
> >
> > > Unfortunately the struct doesn't know at compile time what the
> > > size of the
On Wed, Jun 07, 2017 at 01:17:39PM +, Nicholas Wilson via
Digitalmars-d-learn wrote:
> On Wednesday, 7 June 2017 at 12:39:07 UTC, Russel Winder wrote:
> > Are there any idiom rules as to where to put import statements in D?
> >
> > In Python they can go anywhere but PEP-8 suggests they
On 06/07/2017 06:50 PM, Russel Winder via Digitalmars-d-learn wrote:
So why isn't a thing of type check_frontend_t*?
It's a thing of type `check_frontend_t`, which is a function pointer
already. When you add an asterisk, you get a pointer to a function pointer.
On Wednesday, 7 June 2017 at 05:43:06 UTC, ag0aep6g wrote:
[snip]
It seems to me this is a topic worthy of a more in-depth article.
If only I felt up to that. :p
When you create a slice 'a' in D (with the current GC and
druntime, at least), what happens behind the scenes is the
allocator
On Wednesday, 7 June 2017 at 18:31:41 UTC, H. S. Teoh wrote:
"Structs" with variable size fields have no direct equivalent
in D's type system, so you'll probably have a hard time mapping
this directly.
What you *could* do, though, is to load the data into a ubyte[]
buffer, then create a
On Wednesday, 7 June 2017 at 19:02:59 UTC, drug wrote:
How do compiler know that you want use `std.conv.to` instead of
_already imported_ `core.time.to`? In general it's impossible.
There is no way for compiler to guess that you want some other
symbol from out there. What if you've imported
On 6/7/17 3:56 AM, Biotronic wrote:
On Wednesday, 7 June 2017 at 05:43:06 UTC, ag0aep6g wrote:
[snip]
It seems to me this is a topic worthy of a more in-depth article. If
only I felt up to that. :p
Your understanding and explanation is excellent actually!
When you create a slice 'a' in D
07.06.2017 22:40, bachmeier пишет:
On Wednesday, 7 June 2017 at 19:02:59 UTC, drug wrote:
How do compiler know that you want use `std.conv.to` instead of
_already imported_ `core.time.to`? In general it's impossible. There
is no way for compiler to guess that you want some other symbol from
This is my script:
HOST_DMD=dmd
MODEL=64
cd dmd
make -fposix.mak MODEL=64 clean
make -fposix.mak ENABLE_RELEASE=1 MODEL=64 DMD=../dmd/src/dmd -j 5
cd ../druntime
make -fposix.mak MODEL=64 clean
make -fposix.mak MODEL=64 DMD=../dmd/src/dmd -j 5
cd ../phobos
make -fposix.mak MODEL=64 clean
On Wednesday, 7 June 2017 at 09:50:41 UTC, Basile B. wrote:
bla bla bla
Actually it's this code:
void main(string[] args)
{
import std.stdio;
import std.compiler;
writeln(vendor);
}
that gives the error. I suspect a regression.
On Wednesday, 7 June 2017 at 09:55:24 UTC, Basile B. wrote:
On Wednesday, 7 June 2017 at 09:50:41 UTC, Basile B. wrote:
bla bla bla
Actually it's this code:
void main(string[] args)
{
import std.stdio;
import std.compiler;
writeln(vendor);
}
that gives the error. I suspect a
On Wed, Jun 07, 2017 at 11:16:14PM +0300, drug via Digitalmars-d-learn wrote:
> 07.06.2017 22:40, bachmeier пишет:
[...]
> > In any event, I made a second suggestion that would always work. If
> > it can't find a match, it asks if you're missing an import
> > statement, as a way to provide the new
Are there any idiom rules as to where to put import statements in D?
In Python they can go anywhere but PEP-8 suggests they should all go at
the top of a file, just after the module documentation string.
--
Russel.
=
Dr
On Thursday, 8 June 2017 at 01:57:47 UTC, Andrew Edwards wrote:
If I hand you a chihuahua for grooming, why am I getting back a
pit bull? I simply want a groomed chihuahua. Why do I need to
consult a wizard to get back a groomed chihuahua?
Because is like a poodle and unless you get your hair
On Thursday, 8 June 2017 at 02:07:07 UTC, Mike B Johnson wrote:
On Thursday, 8 June 2017 at 01:57:47 UTC, Andrew Edwards wrote:
If I hand you a chihuahua for grooming, why am I getting back
a pit bull? I simply want a groomed chihuahua. Why do I need
to consult a wizard to get back a groomed
On Thursday, 8 June 2017 at 02:19:15 UTC, Andrew Edwards wrote:
Pretty funny. But seriously, this is something that just work.
There is now to layers of indirection to achieve what I used to
do quite naturally in the language.
*should just work
On Wednesday, 7 June 2017 at 21:13:37 UTC, H. S. Teoh wrote:
On Wed, Jun 07, 2017 at 11:16:14PM +0300, drug via
Digitalmars-d-learn wrote:
07.06.2017 22:40, bachmeier пишет:
[...]
> In any event, I made a second suggestion that would always
> work. If it can't find a match, it asks if you're
Ranges may be finite or infinite but, while the destination may
be unreachable, we can definitely tell how far we've traveled. So
why doesn't this work?
import std.traits;
import std.range;
void main()
{
string[string] aa;
// what others have referred to as
// standard sort works
On Thursday, 8 June 2017 at 02:21:03 UTC, Stanislav Blinov wrote:
aa.keys.sort() should just work as is: aa.keys returns a
string[], and that's a random access range that can be sorted.
What exactly is the error?
It does not ... I provided the code and related error message.
See the line
On Thursday, June 08, 2017 01:57:47 Andrew Edwards via Digitalmars-d-learn
wrote:
> Ranges may be finite or infinite but, while the destination may
> be unreachable, we can definitely tell how far we've traveled. So
> why doesn't this work?
>
> import std.traits;
> import std.range;
>
> void
On Thursday, 8 June 2017 at 01:57:47 UTC, Andrew Edwards wrote:
Ranges may be finite or infinite but, while the destination may
be unreachable, we can definitely tell how far we've traveled.
So why doesn't this work?
import std.traits;
import std.range;
void main()
{
string[string] aa;
On Thursday, 8 June 2017 at 02:25:17 UTC, Jonathan M Davis wrote:
Oh I see, the was error related to iteration, not sorting.
Ranges do not support iterating with an index. The workaround
if you want to have an index with ranges and foreach, then you
should use lockstep:
On Thursday, June 08, 2017 02:31:43 Stanislav Blinov via Digitalmars-d-learn
wrote:
> On Thursday, 8 June 2017 at 02:25:17 UTC, Jonathan M Davis wrote:
>
> Oh I see, the was error related to iteration, not sorting.
>
> > Ranges do not support iterating with an index. The workaround
> > if you
On Thursday, 8 June 2017 at 01:57:47 UTC, Andrew Edwards wrote:
Ranges may be finite or infinite but, while the destination may
be unreachable, we can definitely tell how far we've traveled.
So why doesn't this work?
...
If I hand you a chihuahua for grooming, why am I getting back a
pit
On Thursday, 8 June 2017 at 02:31:43 UTC, Stanislav Blinov wrote:
On Thursday, 8 June 2017 at 02:25:17 UTC, Jonathan M Davis
wrote:
Oh I see, the was error related to iteration, not sorting.
Ranges do not support iterating with an index. The workaround
if you want to have an index with
On Thursday, 8 June 2017 at 02:19:15 UTC, Andrew Edwards wrote:
Pretty funny. But seriously, this is something that should just
work. There is now to layers of indirection to achieve what I
used to do quite naturally in the language.
Hmmm while working on my recent sudoku solver using
On Thursday, June 08, 2017 03:15:11 Andrew Edwards via Digitalmars-d-learn
wrote:
> On Thursday, 8 June 2017 at 02:31:43 UTC, Stanislav Blinov wrote:
> > On Thursday, 8 June 2017 at 02:25:17 UTC, Jonathan M Davis
> > wrote:
> >
> > Oh I see, the was error related to iteration, not sorting.
> >
>
On Thursday, 8 June 2017 at 03:40:08 UTC, Jonathan M Davis wrote:
On Thursday, June 08, 2017 03:15:11 Andrew Edwards via
Digitalmars-d-learn wrote:
I completely understand the differences between ranges and
arrays... the thing is, I wasn't working with ranges but
arrays instead. If sort
On Thursday, 8 June 2017 at 04:07:22 UTC, Andrew Edwards wrote:
On Thursday, 8 June 2017 at 03:40:08 UTC, Jonathan M Davis
sort() returns a SortedRange so that other algorithms can
know...
Yes, I understand that. Again, using "std.range: release" earns
me nothing more than I already get
On Wednesday, 7 June 2017 at 12:39:07 UTC, Russel Winder wrote:
Are there any idiom rules as to where to put import statements
in D?
In Python they can go anywhere but PEP-8 suggests they should
all go at the top of a file, just after the module
documentation string.
I don't know if there
On Wednesday, 7 June 2017 at 13:27:05 UTC, Wulfklaue wrote:
Some of the dmd error messages need some tweaking.
import std.datetime;
auto t = Clock.currStdTime;
writeln(to!string(t));
Result in:
Error: template core.time.to cannot deduce function from
argument types !(string)(long),
On Wednesday, 7 June 2017 at 12:39:07 UTC, Russel Winder wrote:
Are there any idiom rules as to where to put import statements
in D?
In Python they can go anywhere but PEP-8 suggests they should
all go at the top of a file, just after the module
documentation string.
Well for ones that
Some of the dmd error messages need some tweaking.
import std.datetime;
auto t = Clock.currStdTime;
writeln(to!string(t));
Result in:
Error: template core.time.to cannot deduce function from
argument types !(string)(long), candidates are:
On Tuesday, 6 June 2017 at 18:08:52 UTC, Ali Çehreli wrote:
Just import modules at local scopes. Here is something that
works:
void displayinfo(T)(T v) {
import std.stdio : writefln;
writefln("%08x", v);
}
void foo() {
import std.meta : AliasSeq;
enum value =
07.06.2017 16:27, Wulfklaue пишет:
Some of the dmd error messages need some tweaking.
import std.datetime;
auto t = Clock.currStdTime;
writeln(to!string(t));
Result in:
Error: template core.time.to cannot deduce function from argument
types !(string)(long), candidates are:
44 matches
Mail list logo