Skip to content

Commit 4b7f1cf

Browse files
committed
replace tables with markdown tables
1 parent b212292 commit 4b7f1cf

1 file changed

Lines changed: 34 additions & 3 deletions

File tree

content/posts/cpp-for-cscharp.md

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,23 @@ ShowBreadCrumbs: true
1717
In C++ most types have the same or a similar name as in C#, but not always.
1818
This is a table that hold a comparison of all fundamental types you should know about:
1919

20-
![types](/images/table-types.png)
20+
| Type: | C# | C++ (classic) | C++ (modern) |
21+
|----------------------------|-----------------|---------------------------|------------------|
22+
| 32 bit floating | ``float`` | ``float`` | - |
23+
| 64 bit floating | ``double`` | ``double`` | - |
24+
| 128 bit floating | ``decimal`` | - | - |
25+
| 8 bit integer signed | ``sbyte`` | ``char`` | ``int8_t`` |
26+
| 8 bit integer unsigned | ``byte`` | ``unsigned char`` | ``uint8_t`` |
27+
| 16 bit integer signed | ``short`` | ``short`` | ``int16_t`` |
28+
| 16 bit integer unsigned | ``ushort`` | ``unsigned short`` | ``uint16_t`` |
29+
| 32 bit integer signed | ``int`` | ``int`` | ``int32_t`` |
30+
| 32 bit integer unsigned | ``uint`` | ``unsigned int`` | ``uint32_t`` |
31+
| 64 bit integer signed | ``long`` | ``long long`` | ``int64_t`` |
32+
| 64 bit integer unsigned | ``ulong`` | ``unsigned long long`` | ``uint64_t`` |
33+
| boolean | ``bool`` | ``bool`` | - |
34+
| character | ``char`` | ``char`` | ``char16_t`` |
35+
| string | ``string`` | ``string`` | - |
36+
| null | ``null`` | ``nullptr`` | - |
2137

2238
## References
2339

@@ -257,11 +273,26 @@ The most commonly used headers in the standard library:
257273

258274
**C++ Standard Library:**
259275

260-
![standardlibrarycpp](/images/cppstd.png)
276+
| Header | Description | Contains |
277+
|------------------|-----------------------------|-----------------------------------------------------------|
278+
| ``<iostream>`` | Console input/output | ``std::cin`` / ``std::cout`` |
279+
| ``<fstream>`` | File input/output | ``std::fstream`` / ``std::ifstream`` / ``std::ofstream`` |
280+
| ``<string>`` | String container | ``std::string`` / ``std::to_string`` |
281+
| ``<vector>`` | Dynamic array container | ``std::vector`` |
282+
| ``<memory>`` | Smart pointers | ``std::unique_ptr`` / ``std::shared_ptr`` |
283+
| ``<utility>`` | Utility components | ``std::move`` / ``std::swap`` / ``std::pair`` |
261284

262285
**Plain C Standard Library:**
263286

264-
![standardlibraryc](/images/cstd.png)
287+
| Header | Description | Contains |
288+
|------------------|-----------------------------|-----------------------------------------------------------|
289+
| ``<stdlib.h>`` | General system utilities | ``malloc`` / ``free`` / ``exit`` |
290+
| ``<stdio.h>`` | General input/output | ``printf`` / ``scanf`` / ``fopen`` / ``fclose`` |
291+
| ``<stdint.h>`` | Fixed width integer types | ``int64_t`` / ``uint64_t`` |
292+
| ``<string.h>`` | String and memory utils | ``strcpy`` / ``strlen`` / ``memcpy`` |
293+
| ``<stdbool.h>`` | Access to the bool type | ``bool`` / ``true`` / ``false`` |
294+
| ``<stddef.h>`` | Several common definitions | ``size_t`` / ``offsetof`` |
295+
| ``<math.h>`` | Math utility functions | ``sin`` / ``cos`` / ``sqrt`` / ``pow`` |
265296

266297
If you are like me and you write C++ is a very plain C kind of way and want access to ``malloc`` and ``free``
267298
and other stuff from the plain C standard library. You could just include ``<stdlib.h>`` and it will work,

0 commit comments

Comments
 (0)