boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

toolchain-hello.c (544B)


      1 #include <stdio.h>
      2 #include <stdarg.h>
      3 
      4 static int sum(int count, ...)
      5 {
      6     va_list ap;
      7     int i, result = 0;
      8 
      9     va_start(ap, count);
     10     for (i = 0; i < count; ++i)
     11         result += va_arg(ap, int);
     12     va_end(ap);
     13     return result;
     14 }
     15 
     16 static long double add_wide(long double left, long double right)
     17 {
     18     return left + right;
     19 }
     20 
     21 int main(void)
     22 {
     23     int result = sum(3, 1, 2, 3);
     24     long double wide = add_wide((long double)result, 1.0L);
     25     (void)wide;
     26     printf("toolchain smoke: %d\n", result);
     27     return result == 6 ? 0 : 1;
     28 }