putting va_list into my OS
Posted: Mon Jun 05, 2006 4:48 pm
How exactly does va_list work(and its macros) and how would i put it into my OS
and ummm well I guess thats it
and ummm well I guess thats it
The Place to Start for Operating System Developers
http://f.osdev.org/
Code: Select all
int printf( const char * format, ... )
{
va_list ap;
va_start( ap, format ) /* i.e., second parameter = last named variable before elipsis (...) */
...
switch ( format[i] ) /* being the conversion specifier */
{
case 'd': {
int value = va_arg( ap, int );
/* print value */
}
case 'f': {
double value = va_arg( ap, double );
/* print value */
}
case 's': {
char * value = va_arg( ap, char * );
/* print value */
}
...
}
...
va_end( ap );
}