@@ -318,7 +318,7 @@ $(H2 $(LNAME2 preprocessor-directives, Preprocessor Directives))
318
318
$(P $(LINK2 https://gcc.gnu.org/onlinedocs/gcc-11.1.0/cpp/Preprocessor-Output.html, linemarker)
319
319
directives are normally embedded in the output of C preprocessors.)
320
320
321
- $(H3 $(LNAME2 pragma, pragma ))
321
+ $(H3 $(LNAME2 pragma, Pragmas ))
322
322
323
323
$(P The following pragmas are supported:)
324
324
@@ -333,7 +333,7 @@ $(H2 $(LNAME2 preprocessor-directives, Preprocessor Directives))
333
333
$(LI $(TT #pragma pack ( pop PopList )))
334
334
)
335
335
336
- $(H4 $(LNAME2 pragma-attribute, pragma attribute))
336
+ $(H4 $(LNAME2 pragma-attribute, `# pragma attribute` ))
337
337
338
338
The following pragma for ImportC allows to set default storage
339
339
classes for function declarations:
@@ -411,7 +411,7 @@ int main()
411
411
$(RATIONALE Implicit function declarations are very error-prone and cause hard
412
412
to find bugs.)
413
413
414
- $(H3 $(LNAME2 pragma-STDC-FENV_ACCESS, #pragma STDC FENV_ACCESS))
414
+ $(H3 $(LNAME2 pragma-STDC-FENV_ACCESS, ` #pragma STDC FENV_ACCESS` ))
415
415
416
416
$(P This is described in C11 7.6.1)
417
417
@@ -436,13 +436,17 @@ $(H2 $(LNAME2 limitations, Limitations))
436
436
$(H3 $(LNAME2 const, Const))
437
437
438
438
$(P C11 specifies that `const` only applies locally. `const` in ImportC applies transitively,
439
- meaning that although $(CCODE int *const p;) means in C11 that `p` is a const pointer to `int`,
439
+ meaning that although:)
440
+
441
+ $(CCODE int *const p;)
442
+
443
+ $(P means in C11 that `p` is a const pointer to `int`,
440
444
in ImportC it means `p` is a `const` pointer to a `const int`.)
441
445
442
446
$(H3 $(LNAME2 volatile, Volatile))
443
447
444
448
$(P The `volatile` type-qualifier (C11 6.7.3) is ignored. Use of `volatile` to implement shared
445
- memory access is unlikely to work anyway, $(LINK2 # _atomic, _Atomic) is for that.
449
+ memory access is unlikely to work anyway, $(RELATIVE_LINK2 _atomic, _Atomic) is for that.
446
450
To use `volatile` as a device register, call a function to do it that is compiled separately,
447
451
or use inline assembler.
448
452
)
@@ -451,7 +455,7 @@ $(H2 $(LNAME2 limitations, Limitations))
451
455
452
456
$(P The `restrict` type-qualifier (C11 6.7.3) is ignored.)
453
457
454
- $(H3 $(LNAME2 _atomic, _Atomic))
458
+ $(H3 $(LNAME2 _atomic, ` _Atomic` ))
455
459
456
460
$(P The `_Atomic` type-qualifier (C11 6.7.3) is ignored.
457
461
To do atomic operations, use an externally compiled function for that, or the inline assembler.)
@@ -499,14 +503,14 @@ struct S { int version; };)
499
503
500
504
$(P On some platforms, C `long` and `unsigned long` are the same size as `int` and `unsigned int`, respectively.
501
505
On other platforms, C `long` and `unsigned long` are the same size as `long long` and `unsigned long long`.
502
- `long double` and `long double _Complex` can be same size as `double` and `double _Complex`.
506
+ `long double` and `long double _Complex` can be the same size as `double` and `double _Complex`.
503
507
In ImportC, these types that are the same size and signed-ness are treated as the same types.
504
508
)
505
509
506
- $(H3 $(LNAME2 _generic, _Generic))
510
+ $(H3 $(LNAME2 _generic, ` _Generic` ))
507
511
508
512
$(P $(B Generic selection) expressions (C11 6.5.1.1) differ from ImportC.
509
- The types in $(LINK2 # same_only_different, Same only Different Types) are
513
+ The types in $(RELATIVE_LINK2 same_only_different, Same only Different Types) are
510
514
indistinguishable in the $(I type-name) parts of $(I generic-association).
511
515
Instead of giving an error for duplicate types per C11 6.5.1.1-2, ImportC
512
516
will select the first compatible $(I type-name) in the $(I generic-assoc-list).
@@ -643,7 +647,7 @@ _Static_assert(sizeof(A) == 1, "A should be size 1");
643
647
$(P Arrays can have `register` storage class, and may be enregistered by the compiler. C11 6.3.2.1-3)
644
648
645
649
646
- $(H3 $(LNAME2 typeof, typeof Operator))
650
+ $(H3 $(LNAME2 typeof, ` typeof` Operator))
647
651
648
652
$(P The `typeof` operator may be used as a type specifier:)
649
653
$(INFORMATIVE_GRAMMAR
@@ -672,7 +676,7 @@ $(GNAME CImportDeclaration):
672
676
)
673
677
674
678
$(P Imports also enable ImportC code to directly import other C files without
675
- needing to create a .h file for them, either.
679
+ needing to create a `.h` file for them, either.
676
680
Imported C functions become available to be inlined.
677
681
)
678
682
@@ -730,13 +734,13 @@ enum E { A = 3; }
730
734
731
735
$(P A control-Z character `\x1A` in the source text means End Of File.)
732
736
733
- $(H3 $(LNAME2 largeDecimal, Signed Integer Literal Larger Than long long))
737
+ $(H3 $(LNAME2 largeDecimal, Signed Integer Literal Larger Than ` long long` ))
734
738
735
739
$(P A signed integer constant with no suffix that is larger than a `long long` type,
736
740
but will fit into an `unsigned long long` type, is accepted and typed as `unsigned long long`.
737
741
This matches D behavior, and that of some C compilers.)
738
742
739
- $(H3 $(LNAME2 dotArrow, Dot and Arror Operators))
743
+ $(H3 $(LNAME2 dotArrow, Dot and Arrow Operators))
740
744
741
745
$(P The `.` operator is used to designate a member of a struct or union value.
742
746
The `->` operator is used to designate a member of a struct or union value pointed to
@@ -782,7 +786,7 @@ size_t x = sizeof(foo());)
782
786
783
787
$(P This code is accepted by `gcc`, but makes no sense for D. Hence,
784
788
although it works in ImportC, it is not representable as D code,
785
- meaning one must use judgement in creating a .di file to interface
789
+ meaning one must use judgement in creating a ` .di` file to interface
786
790
with C `noreturn` functions.)
787
791
788
792
$(P Furthermore, the D compiler takes advantage of `noreturn` functions
@@ -999,12 +1003,6 @@ $(H2 $(LNAME2 warnings, Warnings))
999
1003
If C11 says it is legal, ImportC accepts it.)
1000
1004
1001
1005
1002
- $(H2 $(LNAME2 builtins, $(TT __builtins.di)))
1003
-
1004
- $(P ImportC uses D to implement several features. These are implemented in the file
1005
- $(LINK2 https://github.com/dlang/dmd/blob/master/druntime/src/__builtins.di, $(TT __builtins.di))
1006
- which is automatically imported for every ImportC compilation.)
1007
-
1008
1006
$(H2 $(LNAME2 importcpp, ImportC++))
1009
1007
1010
1008
$(P ImportC will not compile C++ code. For that, use $(TT dpp).)
@@ -1021,7 +1019,7 @@ $(H2 $(LNAME2 other-solutions, Other Solutions))
1021
1019
$(P From the Article:)
1022
1020
1023
1021
$(BLOCKQUOTE dpp is a compiler wrapper that will parse a D source
1024
- file with the .dpp extension and expand in place any #include directives
1022
+ file with the ` .dpp` extension and expand in place any ` #include` directives
1025
1023
it encounters, translating all of the C or C++ symbols to D, and then
1026
1024
pass the result to a D compiler (DMD by default).)
1027
1025
@@ -1063,7 +1061,7 @@ $(H2 $(LNAME2 internals, How ImportC Works))
1063
1061
$(P This co-opting of the D semantic implementation allows ImportC to be able to do things
1064
1062
like handle forward references, CTFE (Compile Time Function Execution), and inlining of C functions
1065
1063
into D code. Being able to handle forward references means it is not necessary to even
1066
- write a .h file to be able to import C declarations into D. Being able to perform CTFE is
1064
+ write a `.h` file to be able to import C declarations into D. Being able to perform CTFE is
1067
1065
very handy for testing that ImportC is working without needing to generate an executable.
1068
1066
But, in general, the strong temptation to add D features to ImportC has been resisted.)
1069
1067
0 commit comments