I'm trying to use va_arg to make a generic factory function in my GUI library. When passing va_arg twice in the same function they pass on the same value instead of two different:
GUIObject* factory(enumGUIType type, GUIObject* parent, ...){ va_list vl; va_start(vl, parent); ... label->SetPosition(va_arg(vl, int), va_arg(vl, int)); va_end(vl); return finalObjectPointer; } factory(LABEL, theParent, 100,200); // Results in position 200:200 What causes this unexpected behavior?