Home › Cross-Language Reference › General Reference PBXB64 Compiler Help

PBXB64 - C Language (V10)

PBXB64 supports a growing C17 subset interoperable with B64/BASIC/PILOT through the unified IR. V10 adds printf/varargs, indirect function pointers, and float arithmetic.

Chapter: General Reference

Description

PBXB64 supports a growing C17 subset interoperable with B64/BASIC/PILOT through the unified IR. V10 adds printf/varargs, indirect function pointers, and float arithmetic.

printf / Varargs (V10)

#include <stdio.h>

Bootstrap printf with string-literal format:

#include <stdio.h>

int main(void) {
    int n = 42;
    printf("V10 answer=%d hex=%x str=%s\n", n, n, "ok");
    return 0;
}
FormatSupport
%d, %iSigned integer
%uUnsigned integer
%x, %XHexadecimal
%oOctal
%cCharacter
%sString
%%Literal percent

Indirect Function Pointers (V10)

call r/m64 via x64 backend
long long add(long long a, long long b) { return a + b; }
long long sub(long long a, long long b) { return a - b; }

int main(void) {
    long long (*fp)(long long, long long);
    int res = 0;
    fp = &add;
    res = (int)fp(20, 22);
    fp = ⊂
    return res + (int)fp(50, 8) - 84;
}

Runtime: malloc / free (V10)

#include <stdlib.h>

int main(void) {
    int* p = (int*)malloc(sizeof(int));
    if (p) { *p = 42; free(p); }
    return 0;
}

Float Arithmetic (V10)

double f(double a, double b) {
    return a * 2.0 + b / 4.0;
}

Preprocessor (V9/V10)

#define MAX 100
#if MAX > 50
    #define MODE 1
#endif

#ifdef __STDC__
    int ver = __STDC_VERSION__;  // 201710L
#endif

_Pragma("GCC diagnostic ignored")  // stripped safely
int line = __LINE__;                // integer
char* file = __FILE__;              // string literal

C17 Headers

26 headers at core/include/c17/. Include with -I:

PBXB64 -I core/include/c17 program.c -o program.exe

Control Flow

switch (x) { case 1: break; case 2: case 3: break; default: break; }
goto label; label: return 0;
return (x > 0) ? 1 : -1;
for (int i = 0; i < 10; i++, j += 2) { body }
if (x) { block } else { block }