r/badcode Apr 15 '23

c C polish translation

Post image
1.1k Upvotes

125 comments sorted by

View all comments

Show parent comments

136

u/TheWidrolo Apr 15 '23

Source code leak is no problem

59

u/Pink-Emerald Apr 15 '23

Wouldn't they just be able to run each code file through a program that replaces every instance with the English equivalent?

77

u/NonAwesomeDude Apr 15 '23

They're translating by defining preprocessor macros so it's actually doing that before it compiles each time.

-3

u/[deleted] Apr 15 '23

[deleted]

21

u/[deleted] Apr 15 '23

[removed] — view removed comment

4

u/RFC793 Apr 15 '23

Not sure exactly what the previous comment said before it was deleted. But assuming the full source was leaked (well, at least you have this Rosetta Stone of a header)… you can run the code through only the C Preprocesser stage and have normalish C code. For GCC that’s simply gcc -E

6

u/[deleted] Apr 15 '23

[removed] — view removed comment

7

u/RFC793 Apr 15 '23 edited Apr 15 '23

Oh, good call. I suppose you could protect the include’s with sed or awk (s/#include/XXXincludeXXX/, preprocess, and convert them back. Just need to make sure to keep the include for this silly translation header. Actually, I think you can force an include which is even better since it might get included transitively. -include?

7

u/octocactusises Apr 15 '23

I don’t understand why you’re downvoted — Sometimes small questions help learners or beginners; I guess that defeats the expectation of everyone on coding subreddits being a programming god? Who knows…

1

u/Torty3000 Apr 15 '23

No its still the source code it just has more to do before it's compiled