Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #162967
| From | Bart <bc@freeuk.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Preprocessor <-> compiler |
| Date | 2021-10-03 20:28 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <sjd09h$t1$1@dont-email.me> (permalink) |
| References | <68d48f9f-4268-47e4-8728-a158cbf9c2ccn@googlegroups.com> <sjclfk$e3c$1@dont-email.me> <0e8f856f-696b-4f32-9b05-f44e04c2ffffn@googlegroups.com> <sjctg9$bim$1@dont-email.me> <cd93ffc7-8fd3-43de-b320-f70a993506d9n@googlegroups.com> |
On 03/10/2021 20:16, Thiago Adams wrote: > On Sunday, October 3, 2021 at 3:41:24 PM UTC-3, Bart wrote: >>> -#pragma are used to control the compiler. what happen using an external preprocessor >>> will just remove the content? >> If an implementation doesn't understand what follows #pragma, then it >> will just ignore it. > > Yes but if you think a traditional preprocessor that runs before and generate a file that > latter will be the input for the compiler then the #pragma is removed (empty line) when the file > is printed and the compiler will not have access to it. No, I said the compiler keeps it in. (Well, I tried gcc, tcc, clang and lccwin which did, and bcc which didn't.) Probably precisely for that reason. > > yes... this is why it is funny. it is like a macro expansion by the compiler. In my language this stuff is done by the parser anyway. > If the information required by the preprocessor from the compiler is > static then everything is easy. sizeof(int) for instance could be > implemented easily if necessary, but sizeof(variable) not. sizeof(int) maybe, but probably not sizeof(int32_t). First this will require headers to be present, that's OK, but int32_t is likely to be a typedef. However this rings a bell ... yes, I've put sizeof() into my own preprocessor, so that this is possible: #if sizeof(int) == 4 but with the aforementioned problems using int32_t.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Preprocessor <-> compiler Thiago Adams <thiago.adams@gmail.com> - 2021-10-03 06:47 -0700
Re: Preprocessor <-> compiler Thiago Adams <thiago.adams@gmail.com> - 2021-10-03 08:38 -0700
Re: Preprocessor <-> compiler Bart <bc@freeuk.com> - 2021-10-03 17:24 +0100
Re: Preprocessor <-> compiler Thiago Adams <thiago.adams@gmail.com> - 2021-10-03 10:55 -0700
Re: Preprocessor <-> compiler Bart <bc@freeuk.com> - 2021-10-03 19:41 +0100
Re: Preprocessor <-> compiler Thiago Adams <thiago.adams@gmail.com> - 2021-10-03 12:16 -0700
Re: Preprocessor <-> compiler Bart <bc@freeuk.com> - 2021-10-03 20:28 +0100
Re: Preprocessor <-> compiler Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-10-03 14:12 -0700
Re: Preprocessor <-> compiler Andrey Tarasevich <andreytarasevich@hotmail.com> - 2021-10-06 08:41 -0700
Re: Preprocessor <-> compiler Thiago Adams <thiago.adams@gmail.com> - 2021-10-06 10:56 -0700
csiph-web