Ary Borenszweig Wrote:
Steve Teale wrote:
OK, so structs are a different beast in D than they are in C++. This
results in one of my most common pitfalls. I'll find myself writing:
struct A
{
int a;
int b;
}
A[] nameTooLong = ...;
foreach (whatever; thingie)
{
Saaa wrote:
...
var_arg!(T) will convert _argptr into the type you specify and it will
also advance _argptr to the next argument.
What would happen if you'd cast it incorrectly if it wasn't a simple pointer
? :D
Same as would happen if you incorrectly cast anything.
i.e. anything.
I probably should have phrased my question better with the array, what I
was
wondering is if it was safe for say two threads to right to the array at
the same
time as long as I'm sure they're not writing to the same index of the
array?
You can do anything you want without thread
On Tue, 12 May 2009 10:12:48 -0400, Saaa em...@needmail.com wrote:
I probably should have phrased my question better with the array, what
I
was
wondering is if it was safe for say two threads to right to the array
at
the same
time as long as I'm sure they're not writing to the same
I probably should have phrased my question better with the array, what
I
was
wondering is if it was safe for say two threads to right to the array
at
the same
time as long as I'm sure they're not writing to the same index of the
array?
You can do anything you want without thread
import std.stdarg;
assert( _arguments[0] is typeid(int*) );
auto arg = va_arg!(int*)(_argptr);
*arg = 10;
Probably.
-- Daniel
Calling the following returns an Access Violation Error after
correctly writing the two lines.
void main()
{
int i;
get( file, `i`, i);
}
public void get(in
Georg Wrede georg.wr...@iki.fi wrote in message
news:guc6ep$2im...@digitalmars.com...
Saaa wrote:
Steven Schveighoffer wrote:
i.e. I want thread 1 to initialize elements 0, 1, and 2, and thread 2 to
initialize elements 3, 4, and 5:
thread1 = new ProcessingThread(arrayToInit[0..3]);
Saaa Wrote:
import std.stdarg;
assert( _arguments[0] is typeid(int*) );
auto arg = va_arg!(int*)(_argptr);
*arg = 10;
Probably.
-- Daniel
Calling the following returns an Access Violation Error after
correctly writing the two lines.
void main()
{
int i;
get( file,
Dear Saaa, these varargs suck badly and you shouldn't use them. It's so
simple to introduce portability errors or heisenbugs, and it's
incredibly hard to get it right. You're better off with alternatives.
Alternative 1: Typesafe Variadic Functions
Useful if the variadic arguments should have
Running this program with Tango SVN + DMD 1.045 or Tango 0.98 + DMD
1.041 on WinXP SP3 32-bit results in a memory leak (the program keeps
increasing in size at every iteration)
leak.d:
---
module leak;
import tango.stdc.stdio;
import tango.core.Memory;
Simpler version, sans printf:
module leak;
import tango.core.Memory;
struct Data
{
Data* prev;
char[4092] something;
}
public void main()
{
Data* data;
Data* newData;
int i;
while(true)
{
for(i = 0; i 10_000; i++)
{
newData = new Data;
Robert Fraser wrote:
Simpler version, sans printf:
module leak;
import tango.core.Memory;
struct Data
{
Data* prev;
char[4092] something;
}
public void main()
{
Data* data;
Data* newData;
int i;
while(true)
{
for(i = 0; i 10_000; i++)
{
12 matches
Mail list logo