Skip to content

Commit cca1eb0

Browse files
Add part about variadic functions
1 parent a998816 commit cca1eb0

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

STYLESHEET.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,24 @@ function SDL_JoystickNameForIndex(device_index: cint): PAnsiChar; cdecl;
210210
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_JoystickNameForIndex' {$ENDIF} {$ENDIF};
211211
```
212212

213+
### Variadic Functions
214+
C:
215+
```c
216+
extern SDL_DECLSPEC void SDLCALL SDL_Log(const char *fmt, ...);
217+
```
218+
219+
Pascal:
220+
221+
```pascal
222+
procedure SDL_Log(fmt: PAnsiChar; Args: array of const); cdecl; overload;
223+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Log' {$ENDIF} {$ENDIF};
224+
procedure SDL_Log(fmt: PAnsiChar); cdecl; overload;
225+
external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_Log' {$ENDIF} {$ENDIF};
226+
```
227+
A variadic C function expands to two overloaded Pascal functions. One which
228+
has no variadic part and one which translates the variadic part (...) to an
229+
array of const.
230+
213231
## C Macros
214232

215233
Macros are pre-processed constructs in C which have no analogue in Pascal.

0 commit comments

Comments
 (0)