fix: use C syntax in tdd skill examples
auto trailing return types are C++ only. Split header and\nimplementation examples into C and C++ variants.
This commit is contained in:
@@ -38,10 +38,21 @@ before the implementation was missing.
|
|||||||
|
|
||||||
Create `<src>/<module>.h` with the public prototype(s).
|
Create `<src>/<module>.h` with the public prototype(s).
|
||||||
|
|
||||||
|
C:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
int fn_name(int arg);
|
||||||
|
```
|
||||||
|
|
||||||
|
C++:
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
#pragma once
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
auto fn_name(int arg) -> int;
|
auto fn_name(int arg) -> int;
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -122,9 +133,21 @@ list(APPEND TEST_TARGETS test_<module>)
|
|||||||
|
|
||||||
Create `<src>/<module>.c` with a dummy return:
|
Create `<src>/<module>.c` with a dummy return:
|
||||||
|
|
||||||
|
C:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
#include "<src>/<module>.h"
|
#include "<src>/<module>.h"
|
||||||
|
|
||||||
|
int fn_name(int arg) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
C++:
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
#include "<src>/<module>.h"
|
||||||
|
|
||||||
auto fn_name(int arg) -> int {
|
auto fn_name(int arg) -> int {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user