Author Topic: Diffs to C99 and C11  (Read 12264 times)

shiv

  • Newbie
  • *
  • Posts: 12
    • View Profile
Diffs to C99 and C11
« on: February 15, 2017, 06:43:38 PM »
I have tried reading through the documentation carefully but I cannot find out what are the precise "evolutions/omissions" over existing standards.

I know that there seems to be discussions about C-style macros. Will the _Generic macro, or something equivalent, be supported? These are quite essential for numerical codes that seek to re-use code over single, double, single complex and double complex numbers. More generically, if macros and #include's are removed, will some other facility be provided for generic programming?

Also, will variable length arrays and multi-dimensional arrays be supported?

Finally, this is outside the standard, what about OpenMP directives?

Thanks.
--shiv--

bas

  • Full Member
  • ***
  • Posts: 220
    • View Profile
Re: Diffs to C99 and C11
« Reply #1 on: February 16, 2017, 04:50:44 PM »
There is a page called 'Changes from C' in the documentation that highlights some big changes. Otherwise
there are many smaller changes. Just look at some code fragments in the examples/ dir and the unit tests.

Macros in C/C++ work by including (copy-pasting) a header file into a .c/cpp file. The preprocessor then does
textual replacements. This is very flexible, but also prevents the compiler from many useful diagnostics
(or at least makes it very hard). There is a post about macros on the forum that explains the different use
cases for macros.

Variable length arrays are supported in function scope (just like newer C standards). At global scope, C2 allows
'adding' items from different parts of the code, but essentially at runtime these are fixed size. Multi-dimensional arrays
are supported just like C/C++.

OpenMP is not in the planning yet..


shiv

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Diffs to C99 and C11
« Reply #2 on: March 07, 2017, 12:14:54 AM »
Looking through the source I see that "#define" is allowed. I also tried and noticed that "#include" is allowed too. Just with those two I can get some of functor like generics that I need.
--shiv--

admin

  • Administrator
  • Newbie
  • *****
  • Posts: 11
    • View Profile
Re: Diffs to C99 and C11
« Reply #3 on: March 13, 2017, 08:05:37 AM »
Since C2 uses the clang preprocessor, all normal C preprocessor command should work. This is more a by-effect than
a real  design target..