Passing va_args...

2005-10-14 Thread Kalaky
Hello,

Once I saw a gcc macro that passes variables arguments to another
variable argument function..example:

function_1 (int z, ...);
function_2 (int z, ...);
{
 return function_1 (z, MACRO);
}

Does anyone remember the macro name ?

TIA


Re: Passing va_args...

2005-10-14 Thread Kalaky
obviously, no. __VA_ARGS__ is a identifier for variadic macros.

I'am looking for some way to pass variable arguments to another
function that receives variable arguments without using va_list.

On 10/14/05, Jairo Balart <[EMAIL PROTECTED]> wrote:
> are you looking for __VA_ARGS__?
>
> Regards,
> Jairo
>
> On Friday 14 October 2005 15:19, Kalaky wrote:
> > Hello,
> >
> > Once I saw a gcc macro that passes variables arguments to another
> > variable argument function..example:
> >
> > function_1 (int z, ...);
> > function_2 (int z, ...);
> > {
> > return function_1 (z, MACRO);
> > }
> >
> > Does anyone remember the macro name ?
> >
> > TIA
>


STL slist/map containers concurrent/thread-safe access

2006-09-14 Thread Kalaky

Hi,

Given that removing/inserting elements from a map/slist/whatever does
not invalidate iterators to list elements, it is safe to use the
element that the iterator "points" to ?

For example:

slist list;

thread A:

lock();
list.insert_after(list.begin(), elem);
unlock();

thread B:

lock();
const_iterator it = slist.begin();
// or
iterator it = slist.begin();

const struct foo& elem = *it;
// or
struct foo& elem = *it'
unlock();

// operations on elem are atomic

while (bar++) {
foo.i++ | *it.i++
// or
if (foo.i == 5)
 foobar();
}

lock();
slist.erase(it);
unlock();