Re: Nested function declarations

2011-01-28 Thread wrzosk
On 28.01.2011 03:35, Akakima wrote: "bearophile" a �crit dans le message de news: iht0ha$2avd$1...@digitalmars.com... This D2 code: import std.math: sqrt; void main() { double sqrt(); double result = sqrt(9.0); } Generates the errors: test.d(4): Error: function test.main.sqrt () is no

Re: Exactly Replicating a Function's Signature?

2011-01-19 Thread wrzosk
A little example ... import std.stdio; import std.traits; import std.typetuple; import std.metastrings; alias ParameterStorageClassTuple PSCT; alias ParameterStorageClass PSC; alias ParameterTypeTuple PTT; string ToStorageName(alias T)() { static if(T == PSC.REF) return "ref"; else stati

Re: Undefined references when linking to C library

2010-12-23 Thread wrzosk
On 23.12.2010 20:38, Peter Federighi wrote: Jonathan M Davis wrote: Did you wrap the C declarations in an extern(C) block? Without that, it's going to think that your variables are D variables not C variables. The same goes for any functions - _especially_ for the functions. In fact, a large por

Re: is this the expected output

2010-12-22 Thread wrzosk
I believe that pt1(r) value is created on the stack, then the thefunc is called with that value (by Value semantic - so another value is created on the stack) and it prints pointer to the value on the stack. Then it returnes so the stack values are destroyed, next iteration begins and all steps

Re: Calling class methods by pointers

2010-11-22 Thread wrzosk
On 23.11.2010 01:22, Jesse Phillips wrote: wrzosk Wrote: The problem i see is that in funcptr there is real entry point for method used, not the index in virtual table, so the polymorphism can't work with that. As I have written - i don't know whether it is correct use for delegate

Calling class methods by pointers

2010-11-22 Thread wrzosk
Is there any way to save pointer to class method, and call it later? I know about ptr, and funcptr properties of delegates. I tried to change ptr and or funcptr manually after delegate was obtained. It worked in some situations. I don't know if it is a correct use of delegate: import std.writ

Re: Combining variadic functions with class templates

2010-09-30 Thread wrzosk
W dniu 2010-10-01 03:13, Sebastian Schuberth pisze: On 30.09.2010 19:58, Simen kjaeraas wrote: This is not a constructor, but a malformed function. In D, constructors bear the name 'this'[1]. Doh, thanks, I should have already known that ... changing "Vector" to "this" makes it better, but wi

Re: Generic container

2010-05-08 Thread wrzosk
On 08.05.2010 23:52, lurker wrote: Hello, first time visiting the newsgroup. I see in the manual that you can create built-in dictionaries like so: int[string] foo; Do you know of a way to store any value in a dictionary? In C# I can do something like this: Dictionary foo; I need a dictiona

Re: string to real conversion losing data

2010-04-08 Thread wrzosk
W dniu 08.04.2010 23:02, jicman pisze: Greetings and salutations! Will someone be so kind as to explain why this is happening? import std.stdio; import std.conv; void main() { char[][] strRealVals = [ "14539.34","1230.00","361.62","1613.10","","","0.00" ]; real rTotal =