Skip to content

YoungHaKim7/cpp_training2024

Repository files navigation


link




vim tab setting[🔝]

set tabstop=2
set shiftwidth=2

Assembly Code로 공부하기 넘 좋다.[🔝]

https://godbolt.org/


내가 정리하는 github[🔝]

C++ Cheat Sheet[🔝]


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

코딩의 근본 shellscript

https://www.shellscript.sh/


C++ 라이브러리 찾는곳[🔝]

https://en.cppreference.com/w/cpp/links/libs

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[🔝]

https://youtu.be/MdtYi0vvct0

Reflect *this!: Design and Implementation of a Mixin Library with Static Reflection - Andy Soffer[🔝]

https://youtu.be/kFChd-RrSP8


구글 differential-privacy[🔝]

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

Cpp : Bjarne Stroustrup[🔝]

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)

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[🔝]

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 ~~~[🔝]

C++ Tutorial ~~[🔝]

국내 C++ 무료 강좌 (모두의 C++) [🔝]

https://modoocode.com/135

구글의 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

Source

Best Hindi Videos For Learning Programming : CodeWithHarry


C++20 Source

C++ Programming Course - Beginner to Advanced



c20 compile[🔝]

  • build.sh
#!/bin/bash

g++ -std=c++2a main.cpp

  • 권한 올려주기macOS 기준
chmod +x 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://youtu.be/YzIBwqWC6EM

출처: 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


- Visual C++ CRT 오류 -

  1. VS에서 scanf, strcpy를 썼을 때 오류가 난다면 맨 위에 #define _CRT_SECURE_NO_WARNINGS를 붙여주세요.

  2. #define _CRT_SECURE_NO_WARNINGS는 #include보다 위에 놓아야 합니다.

  3. 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://modoocode.com/231

C#: https://learn.microsoft.com/en-us/dotnet/csharp/tour-of-csharp (영어; 한국어 번역은 기계번역, 퀄리티 낮음)

Rust: https://doc.rust-lang.org/book (영어)

더 나은 한국어 자료를 알고 계신다면 언제든지 방장에게 알려주세요. 내용이 충분히 정확하면서 학습자의 학습을 방해하지 않는 좋은 문장력을 갖춘 자료를 찾고 있습니다. 위 항목 외에도 유니티, 언리얼, 그래픽스 등에 관련된 위 목록에 꼭 들어갔으면 좋겠다고 생각하시는 자료가 있다면 언제든지 알려주세요.