4 ms·
The approach presented introduces #pragmas which practically contain the code written in the language which extends the C language, as in the example: doubl
by acqq 6y ago
The approach presented introduces #pragmas which practically contain the code written in the language which extends the C language, as in the example:
double A[] = {
#pragma CMOD amend foreach ANIMAL:N = goose dog cat
[${ANIMAL }] = 2*${N},
#pragma CMOD done
};
Personally, I don't like such an approach, as the convention through the decades was that #pragmas don't contain the code but just the "directives", that is, that it should be able to "read" the code without the #pragmas, which is here impossible (one would completely miss the "foreach" and "goose", "dog" and "cat").
As the idea is to have a preprocessing step before the result is fed to the compiler, a little better preprocessor could be written which would remove the requirement of having such pragmas.
Note that such kind of a bit stronger preprocessor was how the initial forms of C++ were implemented (1983) 37 years ago:
https://en.wikipedia.org/wiki/Cfront https://en.wikipedia.org/wiki/Cfront
"The preprocessor did not understand all of the language and much of the code was written via translations."
Even older preprocessor (1974), 46 years ago, also implemented in Bell Labs, was Ratfor:
https://en.wikipedia.org/wiki/Ratfor https://en.wikipedia.org/wiki/Ratfor
- amir734jj 6y ago#pragmas don't contain the code but just the "directives" Agreed. I am using pragmas in my Ph.D. thesis. I think pragma should contain some information for the compiler and the compiler can apply binding phase for things referenced in pragma. No more. Having code in pragma is too much.