Няшная / Говнокод #26381 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
// I'm interested in using something other than the C preprocessor to preprocess my C and Objective-C source code. Are there good alternatives?
//
// ---
//
// You can use PHP as a C preprocessor. The advantages are:
//
// - very similiar syntax, so syntax highlighting works.
// - <? and ?> are not used in standard C (with non-standard C, the only thing that gets broken is old GCC extension operator that returns min/max)
// - it's rich in libraries.
// - it's turing complete.
// - usage of macros is very explicit. (compared to sneaky C preprocessor macros)
// For serious use though, making PHP print the #line directives is needed for debugging preprocessed code.

<?php include_once "stdio.h"; ?>

int main()
{
    <?php
        for($i = 0; $i < 20; $i++)
            echo 'printf("%d\n", '.$i.');';
    ?>
}

https://stackoverflow.com/a/16256052

абсолютно невыносимо

Запостил: Fike Fike, (Updated )

Комментарии (9) RSS

Добавить комментарий

Где здесь C++, guest?!

    А не использовать ли нам bbcode?


    8