Skip to content

Conversation

@Swiftshine
Copy link

With GHS, ccppc and cxppc both determine the file type by its extension. Since the files the scratch uses are called ctx.c and code.c, they're treated as C files. The flag dotciscxx is needed to treat them as C++ files instead.

@aboood40091
Copy link

Before this PR is accepted, I think it's better to consider how other platforms handle it?
Do they let you choose the language? (I have not used the platform much yet.)
Otherwise why even add this flag instead of renaming the files to use the .cpp extension?

@Mc-muffin
Copy link
Contributor

Mc-muffin commented Dec 8, 2025

Other platforms also expose the language as a drop-down, which just sets a compiler flag (-x c++ for GCC for instance), so conceptually this solution is okay.

@mkst
Copy link
Collaborator

mkst commented Dec 8, 2025

Is there a flag to explicitly set C (rather than C++)? such that we can leverage LanguageFlagSet behaviour like other compilers?

edit looks like -nodotciscxx might do the trick?

edit2 seems like we arent super consistent given we take the language from the compiler to determine file extension, rather than dynamically from flags (unless im missing something) ?

@Swiftshine
Copy link
Author

Swiftshine commented Dec 8, 2025

Alternatively, you could use -filetype.[extension] where [extension] is c, cpp, etc. (e.g. -filetype.cpp code.c), though that would have to come directly before the filenames. Is there a way to guarantee that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants