Opened 16 years ago

Closed 15 years ago

#235 closed enhancement (fixed)

variadic formals

Reported by: bperry Owned by: Stephen Siegel
Priority: major Milestone: 1.1
Component: multiple Version: 1.1
Keywords: Cc:

Description

Functions such as printf, fscanf, etc. take in variadic formals:

printf(char *, ...);

We need to support that at the model level.

Change History (3)

comment:1 by Stephen Siegel, 15 years ago

Component: Administrationmultiple
Owner: set to Stephen Siegel
Status: newaccepted

comment:2 by Stephen Siegel, 15 years ago

Milestone: 1.1
Priority: minormajor
Version: 1.1

On both the AST and Model levels, function declarations should have a new boolean field added:

boolean hasVariableArgs();

Its default value is false. Constructors, and so on, might have to be modified to allow this bit to be set to true. Since it is rare, it might make sense to just add a method to set it (to true or false) after the function or node object is created:

void setVariableArgs(boolean value);

To actually use the variadic args in a function body, several macros and a type must be defined. See C99 Standard Sec. 7.15.

For now, it suffices to use variadic args only in system functions, such as the ones listed above. The classes implementing these system function can access all of their arguments in the usual way.

comment:3 by Stephen Siegel, 15 years ago

Resolution: fixed
Status: acceptedclosed

Will require further work for user-defined variadic functions but that is more rare and can be a separate ticket.

Note: See TracTickets for help on using tickets.