Programming/C++ 7

What should main() return in C and C++?

In C90, main() must have an explicit return statement at the end to avoid undefined behaviour. In C99 and newer, you may omit the return statement from main(). If you do, and main() finished, there is an implicit return 0. C90에선 main() 함수에서 무조건 반환 타입을 정의 해야했지만, C99부터 묵시적으로 return 0 를 수행하기 때문에 생략가능해졌다. 참고 : https://stackoverflow.com/questions/204476/what-should-main-return-in-c-and-c

Programming/C++ 2023.04.04

clang-tidy modernize-pass-by-value 문서 번역 및 해설

modernize-pass-by-value With move semantics added to the language and the standard library updated with move constructors added for many types it is now interesting to take an argument directly by value, instead of by const-reference, and then copy. This check allows the compiler to take care of choosing the best way to construct the copy. 언어에 이동 의미론(move semantics)이 추가되고 많은 타입에 대한 이동 생성자(move c..

Programming/C++ 2022.12.13

[C/C++] Comma Operator 콤마 연산자

아래 처럼 조건문에서 입력과 조건체크를 함께 진행하는 경우 유용할 수 있습니다. if (numeric_read(str, &err), !err) numeric_read함수는 호출만 되고, !err 조건만 판단하게 됩니다. 콤마 연산자에 대한 자세한 설명은 아래 링크들을 참고해주세요 https://dad-rock.tistory.com/117 https://www.inflearn.com/questions/137837 https://stackoverflow.com/questions/16475032/comma-operator-in-if-condition

Programming/C++ 2022.06.17

can't delete incomplete type

class SessionImpl; class Session { public: Session() = default; virtual ~Session() = default; private: std::unique_ptr pImpl_; }; 이 코드를 빌드하면 visual studio 에서 아래 오류가 발생한다. 오류 C2027 정의되지 않은 형식 'SessionImpl'을(를) 사용했습니다. 경고 C4150 불완전한 형식 'SessionImpl'에 대한 포인터를 삭제했습니다. 소멸자가 호출되지 않습니다. 오류 C2338 can't delete an incomplete type 이유는 SessionImpl 이 전방선언되어 있고 Session의 생성자/소멸자가 SessionImpl의 정의를 알 수 없기 때문이다. ..

Programming/C++ 2021.05.17

전문가를 위한 c++ 개정4판 오탈자 등록

전문가를 위한 c++ 개정4판 읽던 도중 내용이 잘못된것 같아 오탈자 등록을 했다. https://www.hanbit.co.kr/store/books/look.php?p_code=B3215427289 전문가를 위한 C++(개정4판) C++는 마스터하기 어렵기로 악명 높지만 풍부한 기능 덕분에 게임이나 상용 소프트웨어 애플리케이션을 개발하는 대표 언어로 자리매김했다. 숙련된 C++ 프로그래머조차 잘 모르는 고급 기능도 www.hanbit.co.kr string_view의 remove_prefix와 remove_suffix동작이 스트링을 축소하려면 시작포인터를 뒤로 보내고 끝포인터를 앞으로 당겨야 하는데, 포인터를 보내는 방향이 반대로 써있는것 같아서 내용 확인 요청을 작성했다. 책 내용이 많다보니 단순 실..

Programming/C++ 2021.05.07

C++ Korea 제5회 세미나 후기

https://festa.io/events/226 C++ Korea 제5회 세미나 - "종합 선물 세트" | Festa! Festa에서 당신이 찾는 이벤트를 만나보세요. festa.io c++ 세미나를 한번도 가본적이 없기도하고 java나 웹개발 진영에 비하면 희귀한(?) 편이라 신청했습니다. 인기가 좋은것 같습니다. 금방 매진됬어요. 듣고 싶었던게 마지막에 있어서 좀 아쉬웠지만 한국마소도 가보고 나쁘지 않았습니다. * 세션 & 발표자료 세션 1 : C++20 Key Features Summary https://www.slideshare.net/mobile/utilforever/c20-key-features-summary C++20 Key Features Summary 모던 C++의 시초인 C++11은 ..

Programming/C++ 2019.04.08