Skip to content

Emitted code after PRINT emitter implementation doesn't compile #14

Description

@FeymoodDEV

Hi! Thanks for the great tutorial. No idea if you're reading these issues, but I noticed a minor odd thing in Part 3 and I thought I'd point it out, either to report it or learn why it happens.

#include <stdio.h>
int main(void){
printf("How many fibonacci numbers do you want?\n");
printf("\n");
printf("%.2f\n", (float)());
return 0;
}

This is fantastic. Teeny Tiny now emits code for printing strings. Run this with your favorite C compiler and it will work.

I tried compiling this with GCC 15.2.1, both gcc out.c and gcc -std=c17 out.c, and it doesn't compile. Line 5 expects an expression before ) token : as far as I can tell, the language doesn't allow an empty typecast (C++ allows it but the typecast syntax is different there). I asked a peer and they couldn't get it to compile without touching the code either.

It's obviously nothing important, but it's made me curious why it's different between your setup and mine?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions