On 24.02.2010 22:19, BCS wrote:
> Hello FeepingCreature,
>
>> On 24.02.2010 05:16, BCS wrote:
>>
>>> I need a function that works like the following:
>>>
T* New(T)() { return new T; }
>>> But that also works with static arrays:
>>>
auto i = New!(int)();
auto a = New!(int[27])()
What can I use instead of the din.readf line below to be able to read
any type in that generic function?
import std.cstream;
struct MyType
{}
void generic(T)()
{
T var;
dout.writef("Please enter a value of type %s: ", T.stringof);
din.readf(&var); // <-- Runtime ERROR for MyType
On 02/24/2010 09:00 AM, daoryn wrote:
Check the "samples" dir inside the dmd instalation folder.
Theres a sample there named "listener.d" that shows how to use D sockets.
If you're using DMD2, the listener.d file is broken. You'll have to convert it
into D2 yourself.
I actually did look at tha
Daniel Keep:
> [1] Except for int<->float. Oh, and objects. Really, this is one thing
> I could just about strangle K&R for: conflating value-preserving,
> non-value-preserving *AND* unsafe conversions all into a single
> construct. Walter, gets slapped with a fish for not putting a bullet in
>
Hello Daoryn,
BCS Wrote:
I need a function that works like the following:
T* New(T)() { return new T; }
But that also works with static arrays:
auto i = New!(int)();
auto a = New!(int[27])();
The cleanest solution I can think of is:
T* New(T)() { return (new T[1]).ptr; }
but that s
Hello FeepingCreature,
On 24.02.2010 05:16, BCS wrote:
I need a function that works like the following:
T* New(T)() { return new T; }
But that also works with static arrays:
auto i = New!(int)();
auto a = New!(int[27])();
The cleanest solution I can think of is:
T* New(T)() { return (
On 24/02/10 20:20, Ellery Newcomer wrote:
Oooh! nice trick!
Ah, it's '_d_th...@4' and quotes help. Yahoo!
Do I need to do anything special to get stack tracing to work? when I
try to compile a simple program it barfs on me and gives
undefined reference to `dladdr'
from
import tango.core.tool
I'm trying to access the symbol table of a mach-o file. I've managed to
access the symbol table but I have two problems:
1. It seems I can't access the whole symbol table if I compare my output
to the output of nm. For example, I have a global struct in the file I'm
examining which doesn't sho
On 02/24/2010 12:37 PM, Robert Clipsham wrote:
On 24/02/10 17:51, Ellery Newcomer wrote:
import tango.core.tools.TraceExceptions;
If you want to use gdb then type 'b _d_throw_exception' (or 'b _d_throw'
for dmd) before you run your app. This will break on every exception
thrown, so yo
Am Wed, 24 Feb 2010 19:58:59 + schrieb Robert Clipsham:
> On 24/02/10 19:46, Fabian Classen wrote:
>> Hi
>> I am new in D.
>> I've the following problem. I want to use a old function out of the C
>> programming language. I'm using D, with the dmd compiler, and the Tango
>> lib. My "dirty" solu
On 24/02/10 19:46, Fabian Classen wrote:
Hi
I am new in D.
I've the following problem. I want to use a old function out of the C
programming language. I'm using D, with the dmd compiler, and the Tango
lib. My "dirty" solution is the following:
version (Tango) extern (C) int getchar();
void mai
Hi
I am new in D.
I've the following problem. I want to use a old function out of the C
programming language. I'm using D, with the dmd compiler, and the Tango
lib. My "dirty" solution is the following:
version (Tango) extern (C) int getchar();
void main() {
char quit = '\0';
w
On 24/02/10 17:51, Ellery Newcomer wrote:
import tango.core.tools.TraceExceptions;
If you want to use gdb then type 'b _d_throw_exception' (or 'b _d_throw'
for dmd) before you run your app. This will break on every exception
thrown, so you may have to hit 'c' a few times to continue at
On 02/24/2010 10:35 AM, Robert Clipsham wrote:
On 24/02/10 15:21, Ellery Newcomer wrote:
On 02/24/2010 09:00 AM, Daniel Keep wrote:
Ellery Newcomer wrote:
On 02/24/2010 03:10 AM, bearophile wrote:
Ellery Newcomer:
Okay, does anyone know a good way to figure out where something like
this is
On 24/02/10 15:21, Ellery Newcomer wrote:
On 02/24/2010 09:00 AM, Daniel Keep wrote:
Ellery Newcomer wrote:
On 02/24/2010 03:10 AM, bearophile wrote:
Ellery Newcomer:
Okay, does anyone know a good way to figure out where something like
this is coming from:
object.Exception: lengths don't ma
On 24.02.2010 05:16, BCS wrote:
> I need a function that works like the following:
>
>> T* New(T)() { return new T; }
>
> But that also works with static arrays:
>
>> auto i = New!(int)();
>> auto a = New!(int[27])();
>
> The cleanest solution I can think of is:
>
>> T* New(T)() { return (new
Ellery Newcomer:
> I want line numbers
http://d.puremagic.com/issues/show_bug.cgi?id=3851
Bye,
bearophile
Ellery Newcomer:
> I want line numbers
You can file a low priority bug request on this then.
Bye,
bearophile
On 02/24/2010 09:00 AM, Daniel Keep wrote:
Ellery Newcomer wrote:
On 02/24/2010 03:10 AM, bearophile wrote:
Ellery Newcomer:
Okay, does anyone know a good way to figure out where something like
this is coming from:
object.Exception: lengths don't match for array copy
void main() {
au
BCS Wrote:
> I need a function that works like the following:
>
> > T* New(T)() { return new T; }
>
> But that also works with static arrays:
>
> > auto i = New!(int)();
> > auto a = New!(int[27])();
>
> The cleanest solution I can think of is:
>
> > T* New(T)() { return (new T[1]).ptr; }
>
Ellery Newcomer wrote:
> On 02/24/2010 03:10 AM, bearophile wrote:
>> Ellery Newcomer:
>>> Okay, does anyone know a good way to figure out where something like
>>> this is coming from:
>>> object.Exception: lengths don't match for array copy
>>
>> void main() {
>> auto a1 = new int[5];
>>
sybrandy Wrote:
> All,
>
> Does anyone know where I can get a simple example of writing a server in
> D? Just a stupid little echo server would be fine. I'm trying to write
> one myself, but for some reason it doesn't seem to be accepting any
> connections. I figure it's something stupidly
On 02/24/2010 03:10 AM, bearophile wrote:
Ellery Newcomer:
Okay, does anyone know a good way to figure out where something like
this is coming from:
object.Exception: lengths don't match for array copy
void main() {
auto a1 = new int[5];
auto a2 = new int[4];
a1[] = a2;
}
Bye,
Ellery Newcomer:
> Okay, does anyone know a good way to figure out where something like
> this is coming from:
> object.Exception: lengths don't match for array copy
void main() {
auto a1 = new int[5];
auto a2 = new int[4];
a1[] = a2;
}
Bye,
bearophile
24 matches
Mail list logo