Namespaces in C++

Patreon ► / thecherno
Twitter ► / thecherno
Instagram ► / thecherno
Discord ► thecherno.com/discord
Series Playlist ► thecherno.com/cpp
Thank you to the following Patreon supporters:
- Dominic Pace
- Kevin Gregory Agwaze
- Sébastien Bervoets
- Tobias Humig
- Peter Siegmund
- Kerem Demirer
Gear I use:
-----------------
BEST laptop for programming! ► geni.us/pakTES
My FAVOURITE keyboard for programming! ► geni.us/zNhB
FAVOURITE monitors for programming! ► geni.us/Ig6KBq
MAIN Camera ► geni.us/t6xyDRO
MAIN Lens ► geni.us/xGoDWT
Second Camera ► geni.us/CYUQ
Microphone ► geni.us/wqO6g7K

Пікірлер: 176

  • @katlehokomeke
    @katlehokomeke6 жыл бұрын

    The "::" is called the scope resolution operator.

  • @guestimator121

    @guestimator121

    4 жыл бұрын

    I've called it "that thing" for almost 20 years now. Not gonna change it now.

  • 4 жыл бұрын

    @@ic6406 It's surprising how much you can actually recollect with watching videos that is about your profession.

  • @mangalegends

    @mangalegends

    4 жыл бұрын

    @@ic6406 sometimes you forget stuff and have to refresh your memory

  • @mamertvonn

    @mamertvonn

    3 жыл бұрын

    @@ic6406 awww sh*t... Ya just got UnoReverseCard-ed

  • @GrantSR

    @GrantSR

    3 жыл бұрын

    @@ic6406 Sometimes, I watch videos about something I already understand to see if that KZreadr actually knows how to explain things and knows what they're talking about. Then I know I'm relatively safe watching their more advanced videos.

  • @yabastacode7719
    @yabastacode77196 жыл бұрын

    Hi cherno I would love to watch your explanations for design patterns in c++

  • @luanbaviloni6714

    @luanbaviloni6714

    6 жыл бұрын

    Dave Wallace I agree with you. Great topic!

  • @ricardo.mazeto

    @ricardo.mazeto

    6 жыл бұрын

    Totally agree.

  • @ZestyMuffins

    @ZestyMuffins

    6 жыл бұрын

    yes cherno explaining design patterns would be very good

  • @yashmalviya4563

    @yashmalviya4563

    5 жыл бұрын

    Yes please.

  • @groberti

    @groberti

    5 жыл бұрын

    @mrtrex01 Well, not really. It is key not to overuse them. People love to apply them to everywhere and anywhere but I'd rather have a programmer who knows some design patterns but would rather think about the given problem and might even customize it rather than one who applies them blindly to anything and everything. They are good for expanding ones view of the "programming world" but should serve as guidelines rather than something that is written in stone.

  • @iluvassembly
    @iluvassembly3 жыл бұрын

    Cherno's hand gesture in the beginning of his vids is literally something out of a videogame. The movement is so smooth.

  • @67hutch

    @67hutch

    Жыл бұрын

    LMAO true

  • @Archdemon93
    @Archdemon935 жыл бұрын

    The best explanation of Namespaces I've found so far!! Thanks a lot Cherno!!!

  • @leontwsn4916
    @leontwsn49166 жыл бұрын

    you are incredible. you make hard to understand topics so much easyer to learn … thank you

  • @9100eric
    @9100eric6 жыл бұрын

    In C++ 17 you can nest like this: namespace orange::apple::fruit etc. (It's my favourite feature.)

  • @BlackJar72

    @BlackJar72

    6 жыл бұрын

    Well, I never thought of it and just thought you'd be able to -- basically makes it like Java / C# with there import / using statements.

  • @TomoyukiAota

    @TomoyukiAota

    5 жыл бұрын

    Before C++ 17, for nested namespace, I would do namespace orange { namespace apple { namespace fruit { // some content with a single indent }}} instead of Cherno's namespace orange { namespace apple { namespace fruit { // some content with a single indent }}}

  • @HermanWillems

    @HermanWillems

    4 жыл бұрын

    @@BlackJar72 Wait for C++20 with imports. GOING to be ALOT better !! :) C++ is evolving quickly to the right direction

  • @joaovitormoreiradias6475
    @joaovitormoreiradias64755 жыл бұрын

    You are such good teacher! Loved the vid

  • @GrantSR
    @GrantSR3 жыл бұрын

    Constantly waiting for the dude to accidentally smack that cactus with the back of his hand.

  • @degrees7117
    @degrees71172 жыл бұрын

    Thank you for the great videos. This is my first day watching your videos. And i love your explanations! And for some reason, the videos you made are so easy to watch! 12mins video ended quickly as if it was a 3minutes vid.

  • @reneerichards6737
    @reneerichards67376 жыл бұрын

    Thank you for this video. I am studying this now in university. It makes more sense now that I understand why you would use it

  • @h.hristov
    @h.hristov6 жыл бұрын

    Quite a chill video. Enjoyed it

  • @mezzanine510
    @mezzanine5105 жыл бұрын

    This was explained so simply, thanks much!

  • @NoName-tn8rq
    @NoName-tn8rq5 жыл бұрын

    Tons of confusion cleared. Thank you.

  • @nikosroom1913
    @nikosroom19134 жыл бұрын

    This is awesome, cleared up a lot for me!

  • @partheshsoni6421
    @partheshsoni64213 жыл бұрын

    Thanks for this quality content!

  • @susiana5
    @susiana56 жыл бұрын

    Thanks for uploading :D new content

  • @Hazit90
    @Hazit905 жыл бұрын

    now i love namespace

  • @abugslife2461
    @abugslife2461 Жыл бұрын

    Very helpful video, thank you!

  • @LunaFlahy
    @LunaFlahy Жыл бұрын

    Thank you for the concise explanation!!!

  • @thestarinthesky_
    @thestarinthesky_4 жыл бұрын

    @7:17 below my mind! That's the exactly answers to some of my questions regarding using namespace in C++; Thank you Cherno! You are extraordinary amazing!

  • @helpfulsquid2502
    @helpfulsquid25022 жыл бұрын

    Wait, so if you think about it, namespaces are used to avoid name conflicts, and "using namespace" is an intruction to remove that namespace, but you may have name conflicts again, since the functions in that namespace no longer have an id, so "using namespace" is actually like losing the point of namespaces

  • @Willifordwav

    @Willifordwav

    Жыл бұрын

    Correct, that’s why most experienced C++ devs do not do it

  • @Anonymous-hv7fh

    @Anonymous-hv7fh

    8 ай бұрын

    But if there is a name space that you use often like std for exmple "Using namespace" Would be helpfull And if there is a commun name just use the :: to specify it Isn that better

  • @ymazalmazal1757
    @ymazalmazal17575 жыл бұрын

    Really cool, thank you !

  • @bobspianosbffl
    @bobspianosbffl4 жыл бұрын

    Thanks for the video, it help me understand what namespaces are. Well explained

  • @Skissouille
    @Skissouille6 жыл бұрын

    I would have loved to hear something about anonymous namespaces . But nice video anyway ;)

  • @zdanek

    @zdanek

    3 жыл бұрын

    Yeah, that was my thought also. They are very useful for introducing local scope functions. Maybe many other properties which I don't know.

  • @tanyeetong5619
    @tanyeetong56194 ай бұрын

    Simplest explanation 👍

  • @tsvetomirdenchev1440
    @tsvetomirdenchev14406 жыл бұрын

    I would love to watch TheCherno's explanations on data structures :)

  • @thestarinthesky_

    @thestarinthesky_

    4 жыл бұрын

    you can check MySchoolCode channel on KZreadl! It is one of the best channels too!

  • @hallo-welt
    @hallo-welt6 жыл бұрын

    Excellent! Thanks

  • @Indemeros
    @Indemeros9 ай бұрын

    Thank you!

  • @stefan-tg6ec
    @stefan-tg6ec3 жыл бұрын

    I was watching on 1.25 speed and after a few minutes i forgot about that and got surprised and impressed by the speed of your typing lol

  • @1matroska
    @1matroska4 жыл бұрын

    Thanks TC!

  • @lifeofmangkorn2475
    @lifeofmangkorn2475 Жыл бұрын

    Thank you. You made so easy.

  • @dukathneu
    @dukathneu2 жыл бұрын

    "Back in the days of C". Me, a C Developer: 😢

  • @aliyousefi8586
    @aliyousefi85863 жыл бұрын

    hi cherno thanku very much for this tutorial

  • @milind006
    @milind00616 күн бұрын

    Maybe it’s because as a professional, I used Java and automatically appreciate how Java does things because I’m familiar and therefore comfortable with it, but I always liked the idea of just importing specifically those classes that you need. You can import all the classes within a package, side but that’s not a good practice. Once you import a class into your source file, you can just use that class name directly. In C++ the practice is to always use the objects and classes with their full namespace prefix, rather than “using namespace::class/object” If there are name conflicts, which isn’t all too common, but if there are, you import the one you use more and use the fully qualified name for the other(s)

  • @brunooliveirasoares7489
    @brunooliveirasoares74894 жыл бұрын

    I don't know how do you do that, but after watch more than 60 videos, you still able to maintain the quality and didactic. Thank you!

  • @mytech6779
    @mytech6779 Жыл бұрын

    I wish my first C++ professor (courses 1 and 2) would have covered namespaces at this level of detail, granted he was already trying to crush a lot into the time he had, but it seems rather important if you ever need to use a library other than std.

  • @Yupppi

    @Yupppi

    6 ай бұрын

    That's the thing though. Namespaces are need to know basis things, not really core to learn to write useful programs. Once you have passed that level in coding, you most likely will have studied more, either formally or by yourself, and will learn about namespaces because they become relevant to you.

  • @mytech6779

    @mytech6779

    6 ай бұрын

    @@Yupppi They are part of the core language and used to some degree in every source file, so they are needed to write useful programs. It isn't necessary to know every syntax detail but the subject should be known a fair bit beyond a blindly adding "using std" at the start of every file.

  • @danielmor5002
    @danielmor50026 жыл бұрын

    Hi dude Awesome videos so far.... great job !!!! can you please create video about network--> Serialization and Unserialization that topic is confusing me :(

  • @theo-dr2dz
    @theo-dr2dz8 ай бұрын

    Also, for people coming from java or some language like that, c++ namespaces are not for organising code. Do not do namespace mylib{} namespace mylib::graphics{} namespace mylib::sounds{} namespace mylib::this{} namespace mylib::that{} etc. Namespaces in c++ are only for preventing naming conflicts. Put everything of mylib in namespace mylib, unless you get conflicts inside your library that would otherwise only be preventable by using forced naming schemes. And c++ namespaces are completely unrelated to source files. You can open and close multiple namespaces inside one source file. You can open and add to the same namespace in multiple files. Another remark. I think the only good situation for using namespace bla; is for getting literal suffixes. So you can do using namespace std::string_literals; auto x {"bla"}; // x is const char* auto y{"bla"s}; // y is std::string, thanks to the s suffix that is defined in std::string_literals It's a pain to use these suffixes without importing the namespace.

  • @_SkyDancer
    @_SkyDancer Жыл бұрын

    Good tutorial. ty.

  • @muhammadtaimourafzal5285
    @muhammadtaimourafzal52853 жыл бұрын

    the baisc purpose of the namespaces is to prevent the naming conflicts

  • @Lastrevio
    @Lastrevio5 жыл бұрын

    really good tutorial i finally understood why namespaces were invented

  • @jairoacosta8940
    @jairoacosta89406 жыл бұрын

    thanks

  • @sepidet6970
    @sepidet69705 жыл бұрын

    I found out that I press like button then I watch your videos, because I believe it will be an awesome one :)))

  • @voidrpg
    @voidrpg4 жыл бұрын

    Thanks this saved my skin when trying to modify a simple hello world example. I forgot all about name spaces not used in 20 years living in a blitz max basic world..

  • @theo-dr2dz
    @theo-dr2dz8 ай бұрын

    The c++ committee has solved the nested namespace thing. Nowadays you can say namespace apple;;functions { //... } and that is the same as namespace apple { namespace functions { //... } }

  • @RaphaelBenHamo
    @RaphaelBenHamo6 жыл бұрын

    best tutorial ever!!!!!!!!!!!!!!

  • @EduardoBilk
    @EduardoBilk6 жыл бұрын

    Great content, as usual! Just one question, In the performance side of things, is there any difference to do a struct or even a static class other than use a namespace? Once I can aswell have variables inside namespaces. I mean, does namespace has any gain once it does not carry all OOP stuff (Inheritance, Polymorphism etc) with it?

  • @darkengine5931

    @darkengine5931

    3 жыл бұрын

    No performance diff and I tend to suggest erring on the side of static methods in those cases mainly because of the fact that namespaces offer using directives, using declarations, and argument-dependent lookup. I remember a colleague of mine trying to use namespaces this way. He used something like this widely as a convention: namespace SomeSystem { void startup(); void shutdown(); } ... except he used this convention for multiple systems. And it resulted in some goofy bugs among the team that ended up calling the wrong startup/shutdown functions. Can't possibly encounter that problem with: class SomeSystem { public: static void startup(); static void shutdown(); }; And of course, you can still add static variables here if you want to code things this way, but unlike namespaces, you can give them something other than public scope. Namespaces are there to avoid clashes between identifiers. That's it. I really don't think anyone should be using them to model anything remotely resembling an object.

  • @BlackJar72
    @BlackJar726 жыл бұрын

    I'd find it very tempting to use them like Java imports (which really are basically a kind of namespace), thought perhaps the abbreviation method would be more controlled. (C++ has inner classes ... how do they compare to Java ... now I'm curious....)

  • @stifflery
    @stifflery4 жыл бұрын

    You are a great teacher man!

  • @lukostello
    @lukostello2 жыл бұрын

    What would it mean for a variable or function to be static inside a namespace? Can you have private functions in a namespace which are only visible to other functions in that namespace?

  • @rcookie5128
    @rcookie51286 жыл бұрын

    nice!

  • @attiqrahman8838
    @attiqrahman88383 жыл бұрын

    love my friend

  • @zuheyr1
    @zuheyr14 жыл бұрын

    Hi Chemo, thank you. Please tell me namespace has nothing to do with physical directory location ? eg 2 functions with identical name in directories /a/b/print.cxx and /a/b/c/print.cxx can still be confused by compiler? Thank you!!

  • @dyogao15
    @dyogao155 жыл бұрын

    Great! !!

  • @joesmackdown
    @joesmackdown6 жыл бұрын

    could you please make a video about C++ threads?

  • @DrensLP
    @DrensLP6 жыл бұрын

    Hi, I'm relatively new to programming and C++ but I already can write some small programs. Now I'm looking for a somewhat bigger project for me to code, just to learn the language and all. Do you guys have an idea? Thank you!

  • @bifrost8832
    @bifrost88323 жыл бұрын

    In the c++ standard library are all the libraries there using the namespace std?

  • @maxbentz
    @maxbentz4 ай бұрын

    I know this is 5 years ago, but nice haricut! 💇🏼

  • @user-po9ko6ml1u
    @user-po9ko6ml1u2 жыл бұрын

    genius

  • @jatinmalhotra2325
    @jatinmalhotra2325 Жыл бұрын

    Query - if we have two namespaces apple and orange that have a print() func with same signature then no error is reported till call to print() is made. But why does the compiler not report error on specifying the namespace itself. 1. using namespace apple; 2. print(); 3. using namespace orange; 4. //print(); Error "error: call of overloaded 'print()' is ambiguous" on uncommenting statement4 but no error after commenting it.

  • @Yupppi
    @Yupppi6 ай бұрын

    So using namespace a = apple is like "import numpy as np" in python?

  • @dXXPacmanXXb
    @dXXPacmanXXb6 жыл бұрын

    How do I decide whether I should make a class or standalone functions? Often I feel independent functions are better but then sometimes I might need a variable to store something outside that function and then maybe a class is better but then i would have to create an object and call that method from that object instead of just using a function and i am always so confused

  • @M4gicT0

    @M4gicT0

    6 жыл бұрын

    Well you would use a class when the functions you wish to implement can be related to each other, like if they all relate to the same thing... When your functions share data between each other, then you need to write a class because it makes everything much easier and creates a scope for the data. However if you only want a few functions to be separated in a class, but don't want to instanciate that class each time because you feel that you don't need to, then simply use static functions / variables ! Or if they are just helper functions that don't store any data, well you could as well use a namespace for those...

  • @Shoutlikeatwebpunktd
    @Shoutlikeatwebpunktd6 жыл бұрын

    Cool video :) Could you maybe also make a video on C++ Iterators, I find them sort of confusing^^

  • @HermanWillems

    @HermanWillems

    4 жыл бұрын

    Which one the OLD one, the Previous one or the Ranges-V3 version?

  • @jeffvenancius
    @jeffvenancius Жыл бұрын

    - help, he needs a doctor - I'm a doctor - help - can't - why - I'm a doctor::law()

  • @cloveramv
    @cloveramv5 жыл бұрын

    Can't the name printing thing be done at the end?

  • @daboxguy3848
    @daboxguy38483 жыл бұрын

    A namespace inside a namespace - talk about organisation. 🤯

  • @chezzyfries
    @chezzyfries Жыл бұрын

    Love the content. You can comment/uncomment a line using shortcut ctrl+/

  • @abcxyz-nd6xh
    @abcxyz-nd6xh3 жыл бұрын

    Neither do I like namespace. But the problem is, if other programmers are using it, and you are working in teams with them, or working on / extending / modifying their code, then you've got to undestand namespace. Unless you are an absolutely solo programmer, developing everything on your own from scratch.

  • @darkengine5931

    @darkengine5931

    3 жыл бұрын

    I've fortunately been with teams that steered clear of them, but they were eclectic teams that consisted of a mixture of C and C++ programmers and we had a C SDK/API where namespaces couldn't be used, and the conventions developed from the C SDK where simple prefix naming conventions were used to avoid clashes.

  • @AbhishekKumar1902
    @AbhishekKumar19025 жыл бұрын

    in ADA language, the synonymous of namespaces is a package, right?

  • @promortalgaming4562
    @promortalgaming45623 жыл бұрын

    Hey Cherno please make a video on how to generate random numbers in C++

  • @rocktimjyotidas4543
    @rocktimjyotidas45434 жыл бұрын

    if an user defines a function then in which namespace will it fall??

  • @djamparo6636
    @djamparo66363 жыл бұрын

    If you suggest not using namespaces in header files, why do you do it in your hazel building a game engine series? (video 5 entry point)

  • @michaeldamolsen

    @michaeldamolsen

    3 жыл бұрын

    I know it is long ago you -asked- commented, but maybe others are wondering. There is huge a difference between using "namespace xyz { ... }" in a header file, and using "using namespace xyz;" in a header file. It is the last one he suggests avoiding at all costs. I just went through the video you referred to, and I did not see him type "using namespace xyz;" anywhere in it, or maybe I overlooked it somehow even though I was specifically looking for it.

  • @djamparo6636

    @djamparo6636

    3 жыл бұрын

    @@michaeldamolsen Hey, thanks for commenting after all this time! I don't remember me writing this one honestly, but I have more experience in c++ right now. Using those kind of names paces is just bad practice as this is not really its intent. I don't know if it was shown in the video and I'm not really wanting to look for it, but thanks for your time! And sorry about the hassle!

  • @GamingDemiurge
    @GamingDemiurge3 жыл бұрын

    I believe people will appreciate a discusion on anonymous namespaces

  • @jakubb4784
    @jakubb47842 жыл бұрын

    What are anonymous namespaces good for?

  • @bloodwolf8307
    @bloodwolf83074 жыл бұрын

    cool

  • @Sauravgpt34
    @Sauravgpt343 жыл бұрын

    Which IDE you're using.

  • @nicetvs7348
    @nicetvs73484 жыл бұрын

    This is sorcery

  • @tzgardner
    @tzgardner2 жыл бұрын

    Is it okay to put namespaces around just #defines?

  • @koungmeng
    @koungmeng5 жыл бұрын

    miss the coffee intro

  • @voxelrifts

    @voxelrifts

    4 жыл бұрын

    IKR :)

  • @agnesakne4409
    @agnesakne44095 жыл бұрын

    how much do you earn cherno?

  • @user-sj6ku2fo6c
    @user-sj6ku2fo6c2 жыл бұрын

    May I ask why we don't need to do #include ?

  • @gtafigosaarea5uno

    @gtafigosaarea5uno

    2 жыл бұрын

    because you're not including class vector, you're including the header file containing class vector.

  • @naoufal450
    @naoufal4505 жыл бұрын

    Finally 0 dislikes (till now).. thank god

  • @MrCri1tical
    @MrCri1tical3 жыл бұрын

    Will anyone ever need to put a nested namespace in any scenario?

  • @ShiOW
    @ShiOW3 жыл бұрын

    I'm learning namespaces because Ivor Horton told me to do so.

  • @ASH-fk7wl
    @ASH-fk7wl6 жыл бұрын

    on the opengl series, i followed up until the shader part and your one drew a red rectangle however, mine is not drawing anything at all and i have no errors (on a mac)

  • @somedude4122

    @somedude4122

    6 жыл бұрын

    That's almost certainly an error in the code. Try grabbing one of the samples onn github to see if your GPU actually supports it

  • @ASH-fk7wl

    @ASH-fk7wl

    6 жыл бұрын

    #include //VERTEX SHADER const char* vertexSource = R"glsl( #version 330 core in vec2 position; void main() { gl_Position = vec4(position, 0.0, 1.0); } )glsl"; //FRAGMENT SHADER const char* fragmentSource = R"glsl( #version 330 core out vec4 outColor; void main(){ outColor = vec4(1.0, 1.0, 1.0, 1.0); } )glsl"; int main(void) { GLFWwindow* window; /* Initialize the library */ if (!glfwInit()) return -1; /* Create a windowed mode window and its OpenGL context */ window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL); glfwWindowHint (GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); if (!window) { glfwTerminate(); return -1; } float vertices[] = { 0.0f, 0.5f, 0.5f, -0.5f, -0.5f, -0.5f, }; float pixels[] = { 0.0f, 0.0f, 0.0f, 1.0f,1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f }; unsigned int tex; glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); unsigned int vbo; glGenBuffers(1, &vbo); // Generate 1 buffer glBindBuffer(GL_ARRAY_BUFFER, vbo); // Makes the buffer active glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW); //CREATING VERTEX SHADER unsigned int vertexShader = glCreateShader(GL_VERTEX_SHADER); glShaderSource(vertexShader, 1, &vertexSource, NULL); glCompileShader(vertexShader); unsigned int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER); glShaderSource(fragmentShader, 1, &fragmentSource, NULL); glCompileShader(fragmentShader); //CREATE THE SHADER PROGRAM unsigned int shaderProgram = glCreateProgram(); glAttachShader(shaderProgram, vertexShader); glAttachShader(shaderProgram, fragmentShader); glLinkProgram(shaderProgram); glUseProgram(shaderProgram); unsigned int posAttrib = glGetAttribLocation(shaderProgram, "position"); glVertexAttribPointer(posAttrib, 2, GL_FLOAT, GL_FALSE, 0, 0); glEnableVertexAttribArray(posAttrib); unsigned int vao; glGenBuffers(1, &vao); glBindBuffer(GL_ARRAY_BUFFER, vao); /* Make the window's context current */ glfwMakeContextCurrent(window); /* Loop until the user closes the window */ while (!glfwWindowShouldClose(window)) { /* Render here */ glClear(GL_COLOR_BUFFER_BIT); glDrawArrays(GL_TRIANGLES, 0, 3); /* Swap front and back buffers */ glfwSwapBuffers(window); /* Poll for and process events */ glfwPollEvents(); } glfwTerminate(); return 0; }

  • @ASH-fk7wl

    @ASH-fk7wl

    6 жыл бұрын

    thats my code. I dont get any errors

  • @somedude4122

    @somedude4122

    6 жыл бұрын

    You bind the VAO before you do anything to the VBO. Binding the VAO effectively resets whatever happened before it.

  • @paulkupper194

    @paulkupper194

    6 жыл бұрын

    Sensi ASH Watch the Episode about dealing with Errors in OpenGL. By default OpenGL does'nt do any Error handling, so there might be Errors that you are not aware of.

  • @landrypierce9942
    @landrypierce99426 жыл бұрын

    Can you make a video about using SPIR-V in OpenGL?

  • @Mrgohar111
    @Mrgohar111Ай бұрын

    Even my typing speed does not match with this guy coding speed

  • @shivanshuwaila440
    @shivanshuwaila4406 жыл бұрын

    which app are you using for programing

  • @kocho4242

    @kocho4242

    6 жыл бұрын

    It's Visual Studio.

  • @TrogdorPlays
    @TrogdorPlays4 жыл бұрын

    Wait he said we should use namespaces throughout serious projects at the end of the video, but earlier he said that you should be using it in as small of scopes as possible?

  • @signalcoder2037

    @signalcoder2037

    2 жыл бұрын

    for the later namespace , he means "using namespace abc; "

  • @grzesiek9514
    @grzesiek95146 жыл бұрын

    Game Engine Series!

  • @katlehokomeke

    @katlehokomeke

    6 жыл бұрын

    Which game engine uses c++

  • @valizeth4073

    @valizeth4073

    6 жыл бұрын

    Like, all.

  • @groberti

    @groberti

    5 жыл бұрын

    Between C and C++ I bet most of them choose C++

  • @alinasrollahzadeh7610
    @alinasrollahzadeh7610 Жыл бұрын

    #include using namespace std; void hello_nerds(string name){ can't

  • @enfoxer1730
    @enfoxer17306 жыл бұрын

    can you please cover __declspec(/*scary_stuff*/) in your next video

  • @programmer474
    @programmer4742 жыл бұрын

    can't classes also solve the naming issue

  • @Jim-sf9qh
    @Jim-sf9qh6 жыл бұрын

    Hi

  • @huyvole9724
    @huyvole97246 жыл бұрын

    hi

  • @abhishekmittal7213
    @abhishekmittal72133 жыл бұрын

    The simple solution to avoid writing std::cout and std::cin and std::endl would to just use #define, cause I dont think anybody would want to use a custom cout,cin or endl #define cout std::cout #define cin std::cin #define endl std::endl

  • @supernenechi
    @supernenechi3 жыл бұрын

    Is it not just the same as just having the name of the library like glfw and then a dot to indicate something inside the library? Like glfw.destroy()? Why does c++ use namespaces instead of doing it like that? This is just confusing for me as iostream doesn't use iostream:: or something, no that's std::?!? In Go for example you would just import the package fmt and then all the functions inside fmt are accessible by just typing in fmt.Printf for example. Why does C++ feel the need to do it so drastically differently and confusing by not even naming the namespace the same as the package name?!

  • @abcxyz-nd6xh
    @abcxyz-nd6xh3 жыл бұрын

    But I believe the Object Encapsulation in C++, has protected symbols (mem-func()s and mem-vars) from being conflicted, to some degree. E.g. class A { void myFunc(); } class B { void myFunc(); } won't be in conflict, because myFunc() has to be referenced to, THROUGH, the higher-level symbols, Class A or B, FIRST, i.e. it is NOT exposed DIRECTLY to the GLOBAL SCOPE.

  • @BlackJar72
    @BlackJar726 жыл бұрын

    Namespace are what drove me away from C++ years ago, though I didn't know it -- I learned a version with no namespaces, and when I upgraded my OS I got a version that had namespaces. Since no one bothered to tall about namespaces I couldn't figure out why code would link and the arcane errors had no real hint. So I said, "Screw it," and switch to using Java exclusively.

  • @FoxSensei
    @FoxSensei5 жыл бұрын

    That 1 dislike is by someone who uses using namespace std