inline variables (C++ 17 and beyond) | Modern Cpp Series Ep. 110

  Рет қаралды 6,062

Mike Shah

Mike Shah

Күн бұрын

Пікірлер: 15
@chillrelax5056
@chillrelax5056 Жыл бұрын
Your videos are like masala chai! Refreshing and insightful!
@MikeShah
@MikeShah Жыл бұрын
Hehe cheers!
@sanjaygatne1424
@sanjaygatne1424 Жыл бұрын
your videos are just awesome. makes the stuff easy to understand.
@MikeShah
@MikeShah Жыл бұрын
Cheers!
@qcnck2776
@qcnck2776 Жыл бұрын
Thanks. Looking forward to more C++ vids
@MikeShah
@MikeShah Жыл бұрын
Cheers, more coming!
@monty6393
@monty6393 Жыл бұрын
Thanks mike for the video..
@MikeShah
@MikeShah Жыл бұрын
Cheers!
@bffever8803
@bffever8803 Жыл бұрын
your video is amazing ,i love it
@MikeShah
@MikeShah Жыл бұрын
Cheers!
@nicksklenicka8926
@nicksklenicka8926 Жыл бұрын
Much appreciated.
@MikeShah
@MikeShah Жыл бұрын
Cheers!
@Byynx
@Byynx Жыл бұрын
Hi can you explain why we can declare the var "static int SomeValue" and then write "int Struct::SomeValue=63" with the same syntax as if we were creating a variable? And is it because the compiler knows "SomeValue" var has to be initialized that the linker trys to find that initialilization in each source file and that's why it executes the line "int Struct::SomeValue=63" from "Struct.cpp" file?
@MikeShah
@MikeShah Жыл бұрын
Struct::SomeValue is part of the scope (Struct:: that is). For static variables, you typically declare in the implementation (.cpp file) the value to build the symbol.
@RobBCactive
@RobBCactive Жыл бұрын
This could have been clearer, an example the main.c variable Struct s isn't apparently used and struct Struct with one member, is not concretely useful. Fundamentally the hpp file attempts to both declare the type and an instance of it, allocating static memory, while consts are replicatable compile time values so implicitly non-extern non global (not lvalues). When Struct.cpp was used static is meaninglessly contradictory as it wasn't in a function scope and it wasn't a file variable. How on earth is this cleaner? It just looks like hacking an erroneous data concept until it compiles. A hint is the compiler error message reminding that it considers Struct a class.
Farmer narrowly escapes tiger attack
00:20
CTV News
Рет қаралды 13 МЛН
Creative Justice at the Checkout: Bananas and Eggs Showdown #shorts
00:18
Fabiosa Best Lifehacks
Рет қаралды 34 МЛН
C++ Weekly - Ep 170 - C++17's `inline` Variables
5:40
C++ Weekly With Jason Turner
Рет қаралды 19 М.
Software Development with C++: Inline Variables
9:42
Nick
Рет қаралды 1,3 М.
31 nooby C++ habits you need to ditch
16:18
mCoding
Рет қаралды 831 М.
to static, or not to static?
32:58
The Cherno
Рет қаралды 38 М.
Introduction to constexpr | Modern Cpp Series Ep. 86
10:56
Mike Shah
Рет қаралды 12 М.
Faster than Rust and C++: the PERFECT hash table
33:52
strager
Рет қаралды 609 М.
Farmer narrowly escapes tiger attack
00:20
CTV News
Рет қаралды 13 МЛН