On Thursday, 27 August 2015 at 12:40:07 UTC, Mike James wrote:
How about...
A lot nicer. :)
On Thursday, 27 August 2015 at 09:00:02 UTC, Andrew Brown wrote:
Hi,
I need to read a binary file, and then process it two bits at a
time. But I'm a little stuck on the first step. So far I have:
import std.file;
import std.stdio;
void main(){
auto f = std.file.read(binaryfile);
auto g
On Thursday, 27 August 2015 at 11:45:14 UTC, anonymous wrote:
On Thursday 27 August 2015 13:15, BBasile wrote:
https://github.com/BBasile/iz/blob/master/import/iz/types.d#L125
https://github.com/BBasile/iz/blob/master/import/iz/types.d#L150
On 8/26/15 8:14 AM, John Burton wrote:
This would be undefined behavior in c++ due to aliasing rules on
pointers. It appears to work reliably in D when I try it, but that's
obviously no guarantee that it's correct or will continue to do so.
Is this correct code in D? And if not, what should I
On Thursday, 27 August 2015 at 12:56:26 UTC, anonymous wrote:
On Thursday 27 August 2015 14:35, BBasile wrote:
Anyway. I cheat a bit with attributes but as long as it's only
for me...I know this kinds of functions are not phobos-level.
Sure, as long as you're cautious and regard those
On 2015-08-25 13:42:38 +, Vladimir Panteleev said:
And, any idea how I can print getcwd() during compile time? I tried but
it's not working by using the function directly... this is really
strange.
getcwd() doesn't work during compile time because it's a system call.
I really don't
On Thursday, 27 August 2015 at 13:14:24 UTC, Daniel Kozák wrote:
On Thu, 27 Aug 2015 13:01:02 +
vitus via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
works ok for me
V tom je ten problém :)
On Thursday 27 August 2015 14:35, BBasile wrote:
Anyway. I cheat a bit with attributes but as long as it's only
for me...I know this kinds of functions are not phobos-level.
Sure, as long as you're cautious and regard those functions as unsafe, you
may be fine. You still risk accidentally
On Monday, 24 August 2015 at 01:01:13 UTC, John Colvin wrote:
enum A = 1;
enum B = C; //Error
static if(A)
enum C = 0;
enum D = C; //OK
Is order supposed to matter here?
Beter:
enum E = 1;
struct Foo{
enum X1 = E;
static if(1) enum E = 2;
enum X2 = E;
}
static
On Thu, 27 Aug 2015 13:01:02 +
vitus via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
On Monday, 24 August 2015 at 01:01:13 UTC, John Colvin wrote:
enum A = 1;
enum B = C; //Error
static if(A)
enum C = 0;
enum D = C; //OK
Is order supposed to matter here?
On Thu, 27 Aug 2015 13:26:11 +
vitus via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote:
On Thursday, 27 August 2015 at 13:14:24 UTC, Daniel Kozák wrote:
On Thu, 27 Aug 2015 13:01:02 +
vitus via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
On Thursday, 27 August 2015 at 16:03:58 UTC, Gary Willoughby
wrote:
Sorry, I mean the three dots '...' that seems to be what the
documentation is referring to. Also the `isCallable` template
uses it.
That just means it can take whatever arguments. The documentation
is just saying it is
On Thursday, 27 August 2015 at 16:12:35 UTC, Adam D. Ruppe wrote:
On Thursday, 27 August 2015 at 16:03:58 UTC, Gary Willoughby
wrote:
Sorry, I mean the three dots '...' that seems to be what the
documentation is referring to. Also the `isCallable` template
uses it.
That just means it can
On Thursday, 27 August 2015 at 15:18:24 UTC, Gary Willoughby
wrote:
What is this function call operator? (...) Where can i learn
more about it?
It is the () at the end of a thing. You can overload it in a
struct by writing an opCall member.
On Thursday 27 August 2015 17:18, Gary Willoughby wrote:
What is this function call operator? (...) Where can i learn more
about it?
http://dlang.org/operatoroverloading.html#function-call
http://ddili.org/ders/d.en/operator_overloading.html#ix_operator_overloading.opCall
On Thu, 27 Aug 2015 15:18:22 +
Gary Willoughby d...@nomad.so wrote:
If you visit this link:
http://dlang.org/phobos/std_traits.html#isCallable
There is this paragraph:
Detect whether T is a callable object, which can be called with
the function call operator (...).
What is
If you visit this link:
http://dlang.org/phobos/std_traits.html#isCallable
There is this paragraph:
Detect whether T is a callable object, which can be called with
the function call operator (...).
What is this function call operator? (...) Where can i learn more
about it?
On Thursday, 27 August 2015 at 15:19:15 UTC, Adam D. Ruppe wrote:
On Thursday, 27 August 2015 at 15:18:24 UTC, Gary Willoughby
wrote:
What is this function call operator? (...) Where can i learn
more about it?
It is the () at the end of a thing. You can overload it in a
struct by writing an
Hello,
Just wondering why compiling the following fails with the -debug
switch, but appears to compile and execute fine without it:
import std.stdio;
import std.algorithm;
import std.container;
int main(string[] args) {
Array!string letters = [b,a,c];
sort(letters[]);
writeln
would someone care to work on updating this? I understand from
Daniel's post in main list that the only thing that doesn't work
is special member functions. that's different from what the
documents say, and it is surely something important for D that
people are aware of this.
I don't
On Thursday, 27 August 2015 at 09:26:55 UTC, rumbu wrote:
On Thursday, 27 August 2015 at 09:00:02 UTC, Andrew Brown wrote:
Hi,
I need to read a binary file, and then process it two bits at
a time. But I'm a little stuck on the first step. So far I
have:
import std.file;
import std.stdio;
I'm a c++ programmer trying to understand how memory allocation
works in D.
I created a struct and added a destructor to it. My understanding
is that structs have deterministic destructors - they are called
when the struct goes out of scope (unless it is allocated with
new).
Now if I put
Hi,
On Thursday, 27 August 2015 at 10:05:31 UTC, John Burton wrote:
understanding is that structs have deterministic destructors -
they are called when the struct goes out of scope
Yes, when they are declared right at the scope, and not contained
in something that might live past the current
On Thursday, 27 August 2015 at 09:38:52 UTC, Andrew Brown wrote:
That's lovely, thank you. One quick question, the length of the
file is not a multiple of the length of ubyte, but the cast
still seems to work. Do you know how it converts a truncated
final section?
Thanks again
Andrew
On Thursday, 27 August 2015 at 10:05:31 UTC, John Burton wrote:
I'm a c++ programmer trying to understand how memory allocation
works in D.
I created a struct and added a destructor to it. My
understanding is that structs have deterministic destructors -
they are called when the struct goes
Ok that's great thank you.
It's quite hard trying to get a proper understanding of memory
allocation in D after years of C++ / RAII / unique_ptr /
shared_ptr . I understand the details of course but it's going to
take a while to really know it.
Is there any way to explicitly free a dynamic
Thanks again for the updates. I've experimented some more and
believe I understand.
To be honest I'm finding it very hard to find the right idioms in
D for safe and efficient programming when I'm so used to C++ /
RAII everywhere. I'll adapt though :P
On Thursday, 27 August 2015 at 10:49:02 UTC, John Burton wrote:
Thanks again for the updates. I've experimented some more and
believe I understand.
To be honest I'm finding it very hard to find the right idioms
in D for safe and efficient programming when I'm so used to C++
/ RAII
On Thursday, 27 August 2015 at 10:49:02 UTC, John Burton wrote:
To be honest I'm finding it very hard to find the right idioms
in D for safe and efficient programming when I'm so used to C++
/ RAII everywhere. I'll adapt though :P
This is true for every new language you learn. You first
On Thursday, 27 August 2015 at 10:49:02 UTC, John Burton wrote:
Thanks again for the updates. I've experimented some more and
believe I understand.
To be honest I'm finding it very hard to find the right idioms
in D for safe and efficient programming when I'm so used to C++
/ RAII
Another option:
Hello\r\n~
world;
On Thursday, 27 August 2015 at 09:38:52 UTC, Andrew Brown wrote:
On Thursday, 27 August 2015 at 09:26:55 UTC, rumbu wrote:
On Thursday, 27 August 2015 at 09:00:02 UTC, Andrew Brown
wrote:
Hi,
I need to read a binary file, and then process it two bits at
a time. But I'm a little stuck on the
On Wednesday, 26 August 2015 at 12:14:54 UTC, John Burton wrote:
This would be undefined behavior in c++ due to aliasing rules
on pointers. It appears to work reliably in D when I try it,
but that's obviously no guarantee that it's correct or will
continue to do so.
Is this correct code in
On Thursday 27 August 2015 13:15, BBasile wrote:
https://github.com/BBasile/iz/blob/master/import/iz/types.d#L125
https://github.com/BBasile/iz/blob/master/import/iz/types.d#L150
https://github.com/BBasile/iz/blob/master/import/iz/types.d#L191
Your use of @trusted is wrong and dangerous.
Ok thank you.
Seems to me that there is enough doubt that this is supported
that I'd be best to avoid relying on it, or at least ensure that
it's all encapsulated in something I can easily change.
On 27/08/15 9:00 PM, Andrew Brown wrote:
Hi,
I need to read a binary file, and then process it two bits at a time.
But I'm a little stuck on the first step. So far I have:
import std.file;
import std.stdio;
void main(){
auto f = std.file.read(binaryfile);
auto g = cast(bool[])f;
On Thursday, 27 August 2015 at 09:00:02 UTC, Andrew Brown wrote:
Hi,
I need to read a binary file, and then process it two bits at a
time. But I'm a little stuck on the first step. So far I have:
import std.file;
import std.stdio;
void main(){
auto f = std.file.read(binaryfile);
auto g
On Thursday, 27 August 2015 at 04:57:14 UTC, Adam D. Ruppe wrote:
On Thursday, 27 August 2015 at 02:50:58 UTC, BBasile wrote:
So the Q: Is this difference normal ?
Yes, it is a feature the Windows format supports but the Linux
one doesn't. On Linux, you need to list the libraries on the
Hi,
I need to read a binary file, and then process it two bits at a
time. But I'm a little stuck on the first step. So far I have:
import std.file;
import std.stdio;
void main(){
auto f = std.file.read(binaryfile);
auto g = cast(bool[]) f;
writeln(g);
}
but all the values of g then
39 matches
Mail list logo