Tips for C++ newbies (compiler code review)

  Рет қаралды 10,381

strager

strager

Күн бұрын

Write better C++ with these quick tips and tricks. Let's improve the lexer in a compiler to make it shorter and less ugly.
Chat with me live for free code reviews, lessons, and career advice: / strager
0:00 shorter tests with const
1:13 don't cast enums
1:54 what is lexing?
2:53 string_to_double
3:44 last_char vs *iterator
4:11 copying identifiers
4:26 parsing comments
5:01 switch
stethoscope clipart PNG Designed By 颖 from Pngtree.com

Пікірлер: 19
@ltstaffel5323
@ltstaffel5323 2 жыл бұрын
This video got you a subscriber! Code reviews are my favorite way of learning from more experienced programmers on YT
@strager_
@strager_ 2 жыл бұрын
I'll publish more code reviews. Thanks for the feedback!
@joseph5413
@joseph5413 2 жыл бұрын
Hey bro, I wanted to ask you a question, for me to improve my programming logic I have to be programming in C++ or can I improve in any programming language?, I know how to program, but my logic to solve problems is horrible.
@strager_
@strager_ 2 жыл бұрын
Write more programs which do interesting things. I recommend avoiding code puzzles, especially sites like LeetCode. It doesn't matter if those programs are in C++ or in another language; your problem-solving skills will improve if you code in any language.
@joseph5413
@joseph5413 2 жыл бұрын
@@strager_ thanks for the tips, I will focus on java .
@leonardodavinci4259
@leonardodavinci4259 9 ай бұрын
@@strager_ Why do you recommend avoiding code puzzle sites like LeetCode?
@thefireagen
@thefireagen Жыл бұрын
Following you on twitch.. to realise how pathetically I write c++😢
@nrwchd
@nrwchd Жыл бұрын
with if you could do if c > ('A' -1) && c < ('Z' + 1) and so on
@strager_
@strager_ Жыл бұрын
Yes, you can do that. But then the other code which matches symbols, strings, etc. is uglier. I don't know if compilers are smart enough to use a jump table if you write 'if ('A'
@nrwchd
@nrwchd Жыл бұрын
it would be nicer and readable in the eye actually bool IsLowerCase(c) bool IsUpperCase(c) bool IsSymbols(c) = IsLowerCase(c) or IsUpperCase(c) or c == '_' bool IsIntegral(c) bool IsFloatingPoint(c) = IsIntegral(c) or c == '.' so on
@yes-ni1od
@yes-ni1od Жыл бұрын
Lol why do people have no idea what they're doing think making a lexer is a good idea
@strager_
@strager_ Жыл бұрын
Because that's how lexers are made. Are there any lexers made by people who know what they're doing? I'm not aware of any.
@psynetFM
@psynetFM Жыл бұрын
Programming is fun! Also, how else do you think you can learn if you don’t try?
@yes-ni1od
@yes-ni1od Жыл бұрын
@@psynetFM I agree, but I would've thought making a lexer is one of the most boring things imaginable. I guess boring is subjective.
@jordixboy
@jordixboy 8 ай бұрын
Isnt that how you learn lol?
Big O myths busted! (Time complexity is complicated)
21:33
strager
Рет қаралды 131 М.
Understanding Code You Didn't Write // Code Review
27:15
The Cherno
Рет қаралды 66 М.
100😭🎉 #thankyou
00:28
はじめしゃちょー(hajime)
Рет қаралды 58 МЛН
Backstage 🤫 tutorial #elsarca #tiktok
00:13
Elsa Arca
Рет қаралды 37 МЛН
15 Years Writing C++ - Advice for new programmers
4:04
SyncMain
Рет қаралды 1,1 МЛН
13 easy Rust tips (code review)
7:43
strager
Рет қаралды 18 М.
GTA3 Code Review: Weapons, Vehicles, Cops and Gangs
15:00
Code With Ryan
Рет қаралды 1 МЛН
ENUMS in every programming language (All you need to know)
24:38
31 nooby C++ habits you need to ditch
16:18
mCoding
Рет қаралды 725 М.
Rust: When C Code Isn't Enough
8:26
CodeAhead
Рет қаралды 152 М.
Pong Clone in C++ // Code Review
34:31
The Cherno
Рет қаралды 94 М.
How to contribute to open source
14:15
strager
Рет қаралды 102 М.
How I use C++: a line-by-line code review
1:40:40
strager
Рет қаралды 230 М.
The Importance of Scalable Code // Code Review
32:10
The Cherno
Рет қаралды 133 М.
WWDC 2024 - June 10 | Apple
1:43:37
Apple
Рет қаралды 10 МЛН
Урна с айфонами!
0:30
По ту сторону Гугла
Рет қаралды 6 МЛН
Карточка Зарядка 📱 ( @ArshSoni )
0:23
EpicShortsRussia
Рет қаралды 785 М.
Жёсткий тест чехла Spigen Classic C1
0:56
Romancev768
Рет қаралды 689 М.
How charged your battery?
0:14
V.A. show / Магика
Рет қаралды 5 МЛН