- gcc/clang ์ต์ ํ์ฉ๋ฒ
- ๊ตฌ๊ธ์-c-๊ฐ์ด๋-๋ผ์ธ
- C/C++ Cheat-Sheet
- c-๋ผ์ด๋ธ๋ฌ๋ฆฌ-์ฐพ๋๊ณณ
- ASCII์์คํค table
-
๋ณ๋ ฌ & ๋์์ฑ
-
(Modern C++์๋ฆฌ์ฆ) ์ด๋ถ์ด ์ต๊ณ The C++ Programming Language | Mike Shah
- modern C++ (C++11,14,17,20,23, etc.)
-
Tutorial(C/C++)
vim tab setting[๐]
set tabstop=2
set shiftwidth=2
Assembly Code๋ก ๊ณต๋ถํ๊ธฐ ๋ ์ข๋ค.[๐]
๋ด๊ฐ ์ ๋ฆฌํ๋ github[๐]
- https://github.com/YoungHaKim7/cpp_training2024
- https://github.com/YoungHaKim7/cpp23_project
C++ Cheat Sheet[๐]
-
C++ Cheat Sheet(๊ฐ๋จํ๊ฒ ๋ณด๊ธฐ ์ข๋ค)
-
Modern C++ Cheatsheet (C11, C14)
C++ vs Rust ๋ณ์ ์ฉ๋ ๋น๊ต ๋ฒ์[๐]
Rust vs C Sizeof | ||||
Rust | C++ | |||
Type Name |
Bytes | Other Names |
Range of Values | |
i8 | __int8 | 1 | char | -128 to 127 |
u8 | unsigned __int8 |
1 | unsigned char |
0 to 255 |
i16 | __int16 | 2 | short, short int, signed short int |
-32,768 to 32,767 |
u16 | unsigned __int16 |
2 | unsigned short unsigned short int |
0 to 65,535 |
i32 | __int32 | 4 | signed, signed int int |
-2,147,483,648 to 2,147,483,647 |
u32 | unsigned __int32 | 4 | unsigned, unsigned int |
0 to 4,294,967,295 |
i32 | int | 4 | signed | -2,147,483,648 to 2,147,483,647 |
u32 | unsigned int | 4 | unsigned | 0 to 4,294,967,295 |
i64 | __int64 | 8 | long long, signed long long |
-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
u64 | unsigned __int64 | 8 | unsigned long long | 0 to 18,446,744,073,709,551,615 |
bool | bool | 1 | none | false or true |
char | char | 1 | none | -128 to 127 by default 0 to 255 when compiled by using |
char | signed char | 1 | none | 128 to 127 |
char | unsigned char | 1 | none | 0 to 255 |
i16 | short | 2 | short int signed short int |
-32,768 to 32,767 |
u16 | unsigned short | 2 | unsigned short int | 0 to 65,535 |
i32 | long | 4 | long int, signed long int |
-2,147,483,648 to 2,147,483,647 |
u32 | unsigned long | 4 | unsigned long int | 0 to 4,294,967,295 |
i64 | long long | 8 | none (but equivalent to __int64) |
-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
u64 | unsigned long long | 8 | none (but equivalent to unsigned __int64) |
0 to 18,446,744,073,709,551,615 |
enum | enum | varies | none | |
f32 | float | 4 | none | 3.4E +/- 38 (7 digits) |
f64 | double | 8 | none | 1.7E +/- 308 (15 digits) |
f64 | long double | same as double | none | Same as double |
u16 | wchar_t | 2 | __wchar_t | 0 to 65,535 |
-
Depending on how it's used, a variable of __wchar_t designates either a wide-character type or multibyte-character type. Use the L prefix before a character or string constant to designate the wide-character-type constant.
-
signed and unsigned are modifiers that you can use with any integral type except bool. Note that char, signed char, and unsigned char are three distinct types for the purposes of mechanisms like overloading and templates.
-
The int and unsigned int types have a size of four bytes. However, portable code should not depend on the size of int because the language standard allows this to be implementation-specific.
-
C/C++ in Visual Studio also supports sized integer types. For more information, see __int8, __int16, __int32, __int64 and Integer Limits.
-
For more information about the restrictions of the sizes of each type, see Built-in types.
-
The range of enumerated types varies depending on the language context and specified compiler flags. For more information, see C Enumeration Declarations and Enumerations.
https://learn.microsoft.com/en-us/cpp/cpp/data-type-ranges?view=msvc-170
C++ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ฐพ๋๊ณณ[๐]
https://en.cppreference.com/w/cpp/links/libs
- C++์ง๋ฌธํ๊ณ ๋ตํด์ฃผ๋ ์ข์ ๊ณณ[๐]
Generators, Coroutines and Other Brain Unrolling Sweetness - Adi Shavit - CppCon 2019[๐]
https://youtu.be/qYHDERleSL8?si=iyod9wk7aMVcnk0r
coroutines(c++)[๐]
https://gcc.gnu.org/wiki/cxx-coroutines
C++ Design Patterns: From C++03 to C++17 - Fedor Pikus - CppCon 2019[๐]
Reflect *this!: Design and Implementation of a Mixin Library with Static Reflection - Andy Soffer[๐]
๊ตฌ๊ธ differential-privacy[๐]
-
Google's differential privacy libraries.
Microsoft C++, C, and Assembler documentation[๐]
- Learn how to use C++, C, and assembly language to develop applications, services, and tools for your platforms and devices.
https://learn.microsoft.com/en-us/cpp/?view=msvc-170
Useful resources | cppreference[๐]
https://en.cppreference.com/w/cpp/links
C++ 98/11/14 manual pages for Linux/MacOS [๐]
https://github.com/aitjcize/cppman
- cppman
- C++ 98/11/14/17/20 manual pages for Linux, with source from cplusplus.com and cppreference.com.
$ pip install cppman
- Demo
- c98๋ถํฐ c++26๊น์ง ๋์จ ๊ธฐ๋ฅ๋ค ์ ์ ๋ฆฌ๋จ
Cpp : Bjarne Stroustrup[๐]
-
C++ Core Guidelines - edt.: Bjarne Stroustrup, Herb Sutter
-
Joint Strike Fighter, C++ Coding Standards - Bjarne Stroustrup (PDF)
Learning C++ eBook - Compiled from StackOverflow Documentation (PDF)[๐]
https://riptutorial.com/Download/cplusplus.pdf
C++.com[๐]
https://cplusplus.com/doc/tutorial/
Compilers[๐]
Use every available and reasonable set of warning options. Some warning options only work with optimizations enabled, or work better the higher the chosen level of optimization is, for example
-Wnull-dereference
with GCC.
You should use as many compilers as you can for your platform(s). Each compiler implements the standard slightly differently and supporting multiple will help ensure the most portable, most reliable code.
GCC / Clang[๐]
-Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic
- use these and consider the following (see descriptions below)
-
-pedantic
- Warn on language extensions -
-Wall -Wextra
reasonable and standard -
-Wshadow
warn the user if a variable declaration shadows one from a parent context -
-Wnon-virtual-dtor
warn the user if a class with virtual functions has a non-virtual destructor. This helps catch hard to track down memory errors -
-Wold-style-cast
warn for c-style casts -
-Wcast-align
warn for potential performance problem casts -Wunused warn on anything being unused -
-Woverloaded-virtual
warn if you overload (not override) a virtual function -
-Wpedantic
(all versions of GCC, Clang >= 3.2) warn if non-standard C++ is used -
-Wconversion
warn on type conversions that may lose data -
-Wsign-conversion
(Clang all versions, GCC >= 4.3) warn on sign conversions -
-Wmisleading-indentation
(only in GCC >= 6.0) warn if indentation implies blocks where blocks do not exist -
-Wduplicated-cond
(only in GCC >= 6.0) warn if if / else chain has duplicated conditions -
-Wduplicated-branches
(only in GCC >= 7.0) warn if if / else branches have duplicated code -
-Wlogical-op
(only in GCC) warn about logical operations being used where bitwise were probably wanted -
-Wnull-dereference
(only in GCC >= 6.0) warn if a null dereference is detected -
-Wuseless-cast
(only in GCC >= 4.8) warn if you perform a cast to the same type -
-Wdouble-promotion
(GCC >= 4.6, Clang >= 3.8) warn if float is implicitly promoted to double -
-Wformat=2
warn on security issues around functions that format output (i.e., printf) -
-Wlifetime
(only special branch of Clang currently) shows object lifetime issues -
-Wimplicit-fallthrough
Warns when case statements fall-through. (Included with -Wextra in GCC, not in clang)
Consider using -Weverything
and disabling the few warnings you need to on Clang
-Weffc++
warning mode can be too noisy, but if it works for your project, use it also.
https://github.com/cpp-best-practices/cppbestpractices/blob/master/02-Use_the_Tools_Available.md
C++ Support in Clang[๐]
- Clang implements the following published and upcoming ISO C++ standards:
- https://clang.llvm.org/cxx_status.html
Language Standard | Flag | Available in Clang? |
---|---|---|
C++2c C++26 |
-std=c++2c | Partial |
C++23 | -std=c++23 -std=c++2b |
Partial |
C++20 | -std=c++20 -std=c++2a |
Partial |
C++17 | -std=c++17 | Clang 5 |
C++14 | -std=c++14 | Clang 3.4 |
C++11 | -std=c++11 | Clang 3.3 |
C++98/C++03 | -std=c++98 | Yes (other than export) |
C++ Concurrency vs Parallelism ~~~[๐]
- CppCon 2017: Fedor Pikus โC++ atomics, from basic to advanced. What do they really do?โ
C++ Tutorial ~~[๐]
- C++ From Scratch | CoffeeBeforeArch
๊ตญ๋ด C++ ๋ฌด๋ฃ ๊ฐ์ข (๋ชจ๋์ C++) [๐]
๊ตฌ๊ธ์ C++ ๊ฐ์ด๋ ๋ผ์ธ[๐]
https://google.github.io/styleguide/cppguide.html
MicroSoft ์ค๋ช ์[๐]
https://learn.microsoft.com/ko-kr/cpp/cpp/welcome-back-to-cpp-modern-cpp?view=msvc-170
Cpp_Training[๐]
Training
-
C++ Programming Course - Beginner to Advanced | freeCodeCamp.org
Best Hindi Videos For Learning Programming : CodeWithHarry
C++ Programming Course - Beginner to Advanced
c20 compile[๐]
- build.sh
#!/bin/bash
g++ -std=c++2a main.cpp
- ๊ถํ ์ฌ๋ ค์ฃผ๊ธฐmacOS ๊ธฐ์ค
chmod +x build.sh
-
how to use c++20 / g++ -std=c++11 -o test test.cpp (build.shโค๏ธํ์ผ ๋ง๋๋๋ฒ)
g++ -std=c++20
// C++20 ๊ธฐ๋ฅ์ GCC 8๋ถํฐ ์ฌ์ฉํ ์ ์์ต๋๋ค.
// C++20 ์ง์์ ํ์ฑํํ๋ ค๋ฉด ๋ช
๋ น์ค ๋งค๊ฐ๋ณ์๋ฅผ ์ถ๊ฐํ์ธ์.
-std=c++20
// G++ 9 ์ด์ ์ฌ์ฉ
-std=c++2a
// ๋๋ C++20 ๊ธฐ๋ฅ ์ธ์ GNU ํ์ฅ์ ํ์ฑํํ๋ ค๋ฉด ๋ค์์ ์ถ๊ฐํ์ญ์์ค.
-std=gnu++20
cpp 17 compile & debug[๐]
$ g++ -Wall -Wextra -std=c++17 main.cpp -o main
$ clang++ -Wall -Wextra -std=c++17 main.cpp -o main
build.sh
#!/bin/bash
clang++ -Wall -Wextra -std=c++17 main.cpp -o main
- 28๋ถ 29์ด Back to Basics: Debugging in C++ - Mike Shah - CppCon 2022
์ถ์ฒ: https://economiceco.tistory.com/15424 [๊ฒฝ์ PLUS:ํฐ์คํ ๋ฆฌ]
c++ algorithm study[๐]
https://github.com/jungeu1509/Algorithm_study
Awesome modern c++[๐]
https://github.com/rigtorp/awesome-modern-cpp
C++20[๐]
https://itnext.io/c-20-coroutines-complete-guide-7c3fc08db89d?gi=b495cc70f832
https://github.com/HappyCerberus/article-cpp20-coroutines
C++โค A modern formatting library[๐]
https://github.com/fmtlib/fmt
-
VS์์ scanf, strcpy๋ฅผ ์ผ์ ๋ ์ค๋ฅ๊ฐ ๋๋ค๋ฉด ๋งจ ์์ #define _CRT_SECURE_NO_WARNINGS๋ฅผ ๋ถ์ฌ์ฃผ์ธ์.
-
#define _CRT_SECURE_NO_WARNINGS๋ #include๋ณด๋ค ์์ ๋์์ผ ํฉ๋๋ค.
-
scanf_s์์ %c ๋๋ %s๋ฅผ ์ธ ๋ ์ฃผ์๊ฐ ๊ฐ๋ฆฌํค๋ ์์ญ์ ํ ๋น๋ ํฌ๊ธฐ๋ฅผ ์ถ๊ฐ๋ก ๋ฃ์ด์ผ ํฉ๋๋ค. ์) scanf_s("%s %c", &s, sizeof s, &c, sizeof c);
C++: https://modoocode.com/135
C++: https://en.cppreference.com (์์ด)
C#: https://learn.microsoft.com/en-us/dotnet/csharp/tour-of-csharp (์์ด; ํ๊ตญ์ด ๋ฒ์ญ์ ๊ธฐ๊ณ๋ฒ์ญ, ํ๋ฆฌํฐ ๋ฎ์)
Rust: https://doc.rust-lang.org/book (์์ด)
๋ ๋์ ํ๊ตญ์ด ์๋ฃ๋ฅผ ์๊ณ ๊ณ์ ๋ค๋ฉด ์ธ์ ๋ ์ง ๋ฐฉ์ฅ์๊ฒ ์๋ ค์ฃผ์ธ์. ๋ด์ฉ์ด ์ถฉ๋ถํ ์ ํํ๋ฉด์ ํ์ต์์ ํ์ต์ ๋ฐฉํดํ์ง ์๋ ์ข์ ๋ฌธ์ฅ๋ ฅ์ ๊ฐ์ถ ์๋ฃ๋ฅผ ์ฐพ๊ณ ์์ต๋๋ค. ์ ํญ๋ชฉ ์ธ์๋ ์ ๋ํฐ, ์ธ๋ฆฌ์ผ, ๊ทธ๋ํฝ์ค ๋ฑ์ ๊ด๋ จ๋ ์ ๋ชฉ๋ก์ ๊ผญ ๋ค์ด๊ฐ์ผ๋ฉด ์ข๊ฒ ๋ค๊ณ ์๊ฐํ์๋ ์๋ฃ๊ฐ ์๋ค๋ฉด ์ธ์ ๋ ์ง ์๋ ค์ฃผ์ธ์.