On Wednesday, 3 July 2013 at 04:51:06 UTC, Jonathan M Davis wrote:
On Wednesday, July 03, 2013 06:44:33 Josh wrote:
On Wednesday, 3 July 2013 at 04:32:15 UTC, Jonathan M Davis
wrote:
On Wednesday, July 03, 2013 06:23:12 Josh wrote:
writeln(to!double(151.42499));//prints 151.425
Is
On Tuesday, 2 July 2013 at 21:49:37 UTC, Gabi wrote:
Hi,
How to find unused imports ?
It seems the compiler doesn't do it, but is there any other
tool for that?
This seems like small issue, but those unused imports pile up
pretty quickly
Regards,
Gabi
I'm working on something like that
On Wednesday, July 03, 2013 08:11:50 Josh wrote:
Jonathan, do you know of any fixed point D library? If not, would
it be worth me making one for phobos?
I am unaware of one, and I don't really know why anyone would really want fixed
point rather than floating point, so I don't know what use
On Tuesday, July 02, 2013 22:14:33 Ali Çehreli wrote:
On 07/02/2013 10:09 PM, Jonathan M Davis wrote:
On Wednesday, July 03, 2013 07:04:47 cal wrote:
void main()
{
double d = 151.42499;
assert(d == 151.42499);
}
The rounding occurs in writeln surely.
On 07/03/2013 07:21 AM, H. S. Teoh wrote:
On Tue, Jul 02, 2013 at 10:14:33PM -0700, Ali Çehreli wrote:
[...]
import std.stdio;
import std.conv;
void main()
{
auto a = to!double(151.42499);
writefln(%.60f, a);
}
I wouldn't write it like that; IMO it's better to write:
On Wednesday, 3 July 2013 at 06:18:28 UTC, Jonathan M Davis wrote:
On Wednesday, July 03, 2013 08:11:50 Josh wrote:
Jonathan, do you know of any fixed point D library? If not,
would
it be worth me making one for phobos?
I am unaware of one, and I don't really know why anyone would
really
On Wednesday, 3 July 2013 at 06:12:46 UTC, Namespace wrote:
On Tuesday, 2 July 2013 at 21:49:37 UTC, Gabi wrote:
Hi,
How to find unused imports ?
It seems the compiler doesn't do it, but is there any other
tool for that?
This seems like small issue, but those unused imports pile up
pretty
On Wednesday, 3 July 2013 at 08:23:40 UTC, monarch_dodra wrote:
My brother in law writes financial apps, and in that field,
using floating points type is *legally* forbidden.
Really? What kind of apps?
On Wednesday, 3 July 2013 at 08:27:52 UTC, Maxim Fomin wrote:
On Wednesday, 3 July 2013 at 08:23:40 UTC, monarch_dodra wrote:
My brother in law writes financial apps, and in that field,
using floating points type is *legally* forbidden.
Really? What kind of apps?
I meant apps as in
Josh:
Is there any way I would be able to hold that number then?
One way to do that is with a simple rationals library,
represented as pairs of bigints.
Bye,
bearophile
On 07/03/13 02:22, Brad Anderson wrote:
C++11's std::tuple includes a function std::tie that takes references to the
arguments and returns a tuple that maintains the references to the arguments.
Along with the usual cases where you'd want reference semantics it also
enables this
On Wednesday, 3 July 2013 at 11:54:39 UTC, Artur Skawina wrote:
Well, aliases can be used to get a similar effect.
template tie(A...) { alias tie = A; }
tie!(a, b) = tuple(1, 2);
artur
Which is actually already in Phobos:
TypeTuple!(a, b) = tuple(1, 2);
On Wednesday, 3 July 2013 at 08:23:40 UTC, monarch_dodra wrote:
On Wednesday, 3 July 2013 at 06:18:28 UTC, Jonathan M Davis
wrote:
On Wednesday, July 03, 2013 08:11:50 Josh wrote:
Long story short, I think both would be a great addition to
phobos/D. I'd personally really want to play with
On 07/03/13 16:52, John Colvin wrote:
Is there any way to take the address of any of an overloaded set of functions?
import std.stdio;
void foo(int a){ writeln(overload int); }
void foo(long b){ writeln(overload long); }
void main()
{
auto b = foo; //ambiguous = error
b(2);
On 07/03/13 17:03, Artur Skawina wrote:
On 07/03/13 16:52, John Colvin wrote:
Is there any way to take the address of any of an overloaded set of
functions?
import std.stdio;
void foo(int a){ writeln(overload int); }
void foo(long b){ writeln(overload long); }
void main()
{
auto b
On Wednesday, 3 July 2013 at 14:52:32 UTC, John Colvin wrote:
Is there any way to take the address of any of an overloaded
set of functions?
import std.stdio;
void foo(int a){ writeln(overload int); }
void foo(long b){ writeln(overload long); }
void main()
{
auto b = foo; //ambiguous =
On Wednesday, 3 July 2013 at 15:03:46 UTC, Artur Skawina wrote:
On 07/03/13 16:52, John Colvin wrote:
Is there any way to take the address of any of an overloaded
set of functions?
import std.stdio;
void foo(int a){ writeln(overload int); }
void foo(long b){ writeln(overload long); }
void
On 07/03/13 17:17, John Colvin wrote:
On Wednesday, 3 July 2013 at 15:05:00 UTC, Dicebot wrote:
On Wednesday, 3 July 2013 at 14:52:32 UTC, John Colvin wrote:
Is there any way to take the address of any of an overloaded set of
functions?
import std.stdio;
void foo(int a){ writeln(overload
On Wed, Jul 03, 2013 at 05:15:48PM +0200, John Colvin wrote:
On Wednesday, 3 July 2013 at 15:03:46 UTC, Artur Skawina wrote:
On 07/03/13 16:52, John Colvin wrote:
Is there any way to take the address of any of an overloaded set
of functions?
import std.stdio;
void foo(int a){
On 07/03/13 17:27, H. S. Teoh wrote:
On Wed, Jul 03, 2013 at 05:15:48PM +0200, John Colvin wrote:
On Wednesday, 3 July 2013 at 15:03:46 UTC, Artur Skawina wrote:
On 07/03/13 16:52, John Colvin wrote:
Is there any way to take the address of any of an overloaded set
of functions?
import
On Wed, Jul 03, 2013 at 05:41:25PM +0200, Artur Skawina wrote:
On 07/03/13 17:27, H. S. Teoh wrote:
On Wed, Jul 03, 2013 at 05:15:48PM +0200, John Colvin wrote:
On Wednesday, 3 July 2013 at 15:03:46 UTC, Artur Skawina wrote:
On 07/03/13 16:52, John Colvin wrote:
Is there any way to take
On 07/03/13 17:43, H. S. Teoh wrote:
On Wed, Jul 03, 2013 at 05:41:25PM +0200, Artur Skawina wrote:
On 07/03/13 17:27, H. S. Teoh wrote:
On Wed, Jul 03, 2013 at 05:15:48PM +0200, John Colvin wrote:
On Wednesday, 3 July 2013 at 15:03:46 UTC, Artur Skawina wrote:
On 07/03/13 16:52, John Colvin
On Wed, Jul 03, 2013 at 06:07:07PM +0200, Artur Skawina wrote:
On 07/03/13 17:43, H. S. Teoh wrote:
On Wed, Jul 03, 2013 at 05:41:25PM +0200, Artur Skawina wrote:
On 07/03/13 17:27, H. S. Teoh wrote:
On Wed, Jul 03, 2013 at 05:15:48PM +0200, John Colvin wrote:
On Wednesday, 3 July 2013 at
On 07/03/13 18:29, Brad Anderson wrote:
On Wednesday, 3 July 2013 at 11:54:39 UTC, Artur Skawina wrote:
On 07/03/13 02:22, Brad Anderson wrote:
C++11's std::tuple includes a function std::tie that takes references to
the arguments and returns a tuple that maintains the references to the
On 07/03/13 18:24, H. S. Teoh wrote:
On Wed, Jul 03, 2013 at 06:07:07PM +0200, Artur Skawina wrote:
The context dependence isn't ideal, but what's the alternative?...
[...]
Explicit syntax for specifying overloads? ;-) Not like that would happen
in D, though.
Real Programmers need no
On Wednesday, 3 July 2013 at 16:35:18 UTC, Artur Skawina wrote:
On 07/03/13 18:29, Brad Anderson wrote:
On Wednesday, 3 July 2013 at 11:54:39 UTC, Artur Skawina wrote:
On 07/03/13 02:22, Brad Anderson wrote:
C++11's std::tuple includes a function std::tie that takes
references to the
Am Sat, 22 Jun 2013 23:27:00 +0200
schrieb bearophile bearophileh...@lycos.com:
Ali Çehreli:
The code compiles under 32-bit (e.g. with the -m32 compiler
switch) where size_t is an alias of uint.
Oh, I see. I compile most of the code on a 32 bit system.
I asked Walter to warn d
You have to parse the unnamed import files, list all their
identifiers (global variables, public functions etc.) and search
for them. ;)
That could be a bit complicated. ;) Therefore I don't want to do
it. Even with named imports you can get false positives.
But if you like it, you could
Am Tue, 2 Jul 2013 22:21:52 -0700
schrieb H. S. Teoh hst...@quickfur.ath.cx:
On Tue, Jul 02, 2013 at 10:14:33PM -0700, Ali Çehreli wrote:
[...]
import std.stdio;
import std.conv;
void main()
{
auto a = to!double(151.42499);
writefln(%.60f, a);
}
I wouldn't write it
On 2013-07-03, 02:22, Brad Anderson wrote:
C++11's std::tuple includes a function std::tie that takes references to
the arguments and returns a tuple that maintains the references to the
arguments.
Along with the usual cases where you'd want reference semantics it also
enables this
On Wed, Jul 03, 2013 at 07:56:28PM +0200, Marco Leise wrote:
Am Tue, 2 Jul 2013 22:21:52 -0700
schrieb H. S. Teoh hst...@quickfur.ath.cx:
On Tue, Jul 02, 2013 at 10:14:33PM -0700, Ali Çehreli wrote:
[...]
import std.stdio;
import std.conv;
void main()
{
auto a =
On Wed, Jul 03, 2013 at 06:52:56PM +0200, Artur Skawina wrote:
On 07/03/13 18:24, H. S. Teoh wrote:
On Wed, Jul 03, 2013 at 06:07:07PM +0200, Artur Skawina wrote:
The context dependence isn't ideal, but what's the alternative?...
[...]
Explicit syntax for specifying overloads? ;-) Not
On Saturday, 29 June 2013 at 19:44:00 UTC, Peter Neubauer wrote:
Please explain why this error happens in the following code:
import std.algorithm;
struct S
{
void foo ()
{
int f1 (int a) { return conv(a); }
int delegate (int) f2 = conv;
int[] x = [1, 2, 3];
x.map!conv;
On 07/03/13 19:10, Brad Anderson wrote:
On Wednesday, 3 July 2013 at 16:35:18 UTC, Artur Skawina wrote:
On 07/03/13 18:29, Brad Anderson wrote:
On Wednesday, 3 July 2013 at 11:54:39 UTC, Artur Skawina wrote:
On 07/03/13 02:22, Brad Anderson wrote:
C++11's std::tuple includes a function
On 07/03/13 21:02, H. S. Teoh wrote:
On Wed, Jul 03, 2013 at 06:52:56PM +0200, Artur Skawina wrote:
void main()
{
auto b = pickOverload!(foo, long);
Now *that's* what I call coolness. Self-documenting and convenient to
use (though in this case it's arguable whether it's
hi,
whilst converting some of my C code into D i got stuck.
in C:
typedef struct { /* info */ } INFO;
INFO info;
size_t checkio;
// read INFO from data file:
pf_datafile = fopen(datafile,rb);
checkio = fread((char *) info, sizeof(info), 1, pf_datafile);
how do i do this in D? i'd like to
On Wed, Jul 03, 2013 at 10:10:08PM +0200, Artur Skawina wrote:
On 07/03/13 21:02, H. S. Teoh wrote:
On Wed, Jul 03, 2013 at 06:52:56PM +0200, Artur Skawina wrote:
void main()
{
auto b = pickOverload!(foo, long);
Now *that's* what I call coolness. Self-documenting and
On 07/03/13 22:44, H. S. Teoh wrote:
On Wed, Jul 03, 2013 at 10:10:08PM +0200, Artur Skawina wrote:
On 07/03/13 21:02, H. S. Teoh wrote:
On Wed, Jul 03, 2013 at 06:52:56PM +0200, Artur Skawina wrote:
void main()
{
auto b = pickOverload!(foo, long);
Now *that's* what I call
On 7/3/13 12:52 PM, Artur Skawina wrote:
import std.stdio;
void foo(int a){ writeln(overload int); }
void foo(long b){ writeln(overload long); }
auto pickOverload(alias FP, A...)() @property { typeof(FP(A.init)) function(A)
fp = FP; return fp;}
void main()
{
auto
How do you open stdout in binary mode with D/Phobos?
In C++ you use something like:
setmode(fileno(stdout), O_BINARY);
(I don't even know where to find O_BINARY in core.stdc).
Bye and thank you,
bearophile
inout(int) foo (inout int a)
{
writeln(a);
return a;
}
I don't know if this is the official method, but
writeln(cast(const)x);
works.
Trying to get answers at:
http://stackoverflow.com/questions/17460065/how-to-print-inout-parameters
I'd like to have a function:
string mangle(string mangled_string);
unittest{
void foo(int x){}
assert(foo.mangleof.demangle.mangle == foo.mangleof);
}
is there such a functionality, even partially?
On Wednesday, 3 July 2013 at 20:37:24 UTC, captaindet wrote:
hi,
whilst converting some of my C code into D i got stuck.
in C:
typedef struct { /* info */ } INFO;
INFO info;
size_t checkio;
// read INFO from data file:
pf_datafile = fopen(datafile,rb);
checkio = fread((char *) info,
On 07/03/2013 01:37 PM, captaindet wrote:
in C:
typedef struct { /* info */ } INFO;
INFO info;
size_t checkio;
// read INFO from data file:
pf_datafile = fopen(datafile,rb);
checkio = fread((char *) info, sizeof(info), 1, pf_datafile);
Just a reminder: The operation above is not
On Wednesday, July 03, 2013 15:37:28 captaindet wrote:
hi,
whilst converting some of my C code into D i got stuck.
in C:
typedef struct { /* info */ } INFO;
INFO info;
size_t checkio;
// read INFO from data file:
pf_datafile = fopen(datafile,rb);
checkio = fread((char *) info,
45 matches
Mail list logo