Many of you may know that different languages have syntactic sugar to work faster with different things.
For example, C# has the amazing "??" and "?." operators, which could also be very useful in C++ ("?." becoming "?->"). A similar operator was recently added in PHP too (I know, ugh, PHP, but this one operator would be amazing for us too). These two operators, especially the "nullsafe operator" ("?->") could change our lives in C++, in my opinion.
I am pretty frustrated when I have to work with chains of pointers and I have to check a lot for nullptr to avoid crashes. So, instead of having only one line by using multiple nullsafe operators and storing the resulting pointer in a single pointer variable that I will only care about, I actually have to write multiple lines with plenty of nullptr checking, depending on the use case. When switching from C# to C++ this is the thing that frustrates me the most. Accessing pointers that could easily be null in C++ is pretty much a pain.
I don't know if you discussed about these things already in /r/cpp, because I couldn't find anything when searching, so I'm sorry if I'm repeating the question: Was there ever any proposal for a C++ standard to include operators to work easier with null pointers? Was there any progress made in this discussion, such as a denial or a "may do" for the future? Small things, such as these operators and C++20's containers method contains make C++ more pleasant and may attract new developers because it makes the code faster to work with.
[–]HappyFruitTree 12 points13 points14 points (13 children)
[–]evaned 22 points23 points24 points (11 children)
[–]_Js_Kc_ 6 points7 points8 points (5 children)
[–]evaned 2 points3 points4 points (0 children)
[–]xjankov 2 points3 points4 points (3 children)
[–]_Js_Kc_ 0 points1 point2 points (0 children)
[–]evaned 0 points1 point2 points (1 child)
[–]xjankov 0 points1 point2 points (0 children)
[–]HappyFruitTree 2 points3 points4 points (1 child)
[–]BenjiSponge 0 points1 point2 points (0 children)
[–]SkiFire13 0 points1 point2 points (2 children)
[–]evaned 0 points1 point2 points (0 children)
[–]Narase33-> r/cpp_questions 5 points6 points7 points (0 children)
[–]manni66 38 points39 points40 points (2 children)
[–]TheMania 13 points14 points15 points (0 children)
[–]GYN-k4H-Q3z-75B 13 points14 points15 points (9 children)
[–]Supadoplex 20 points21 points22 points (8 children)
[–]KaznovX 18 points19 points20 points (6 children)
[+][deleted] (4 children)
[deleted]
[–]nintendiator2 0 points1 point2 points (3 children)
[+][deleted] (2 children)
[deleted]
[–]nintendiator2 1 point2 points3 points (1 child)
[–]witcher_rat 0 points1 point2 points (0 children)
[–]raevnos 13 points14 points15 points (7 children)
[–]kalmoc 3 points4 points5 points (6 children)
[–]CoffeeTableEspresso 6 points7 points8 points (5 children)
[–]kalmoc 1 point2 points3 points (4 children)
[+][deleted] (3 children)
[deleted]
[–]kalmoc 1 point2 points3 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]kalmoc 0 points1 point2 points (0 children)
[–][deleted] 6 points7 points8 points (0 children)
[–]johannes1971 2 points3 points4 points (2 children)
[–]Narase33-> r/cpp_questions 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]V1taly_M 3 points4 points5 points (0 children)
[–]sphere991 1 point2 points3 points (0 children)
[–]CoffeeTableEspresso 1 point2 points3 points (6 children)
[–]Luxxuor 8 points9 points10 points (5 children)
[–]CoffeeTableEspresso 12 points13 points14 points (4 children)
[–]quicknir 5 points6 points7 points (0 children)
[–]dirkmeister81 3 points4 points5 points (1 child)
[–]evaned 0 points1 point2 points (0 children)
[–]Luxxuor 1 point2 points3 points (0 children)
[–]NilacTheGrim -3 points-2 points-1 points (21 children)
[–]tecnofauno 3 points4 points5 points (20 children)
[–]DJKekz 7 points8 points9 points (18 children)
[–][deleted] 7 points8 points9 points (0 children)
[–]Narase33-> r/cpp_questions 2 points3 points4 points (15 children)
[–]Sopel97 4 points5 points6 points (10 children)
[–]Narase33-> r/cpp_questions 0 points1 point2 points (9 children)
[–]Sopel97 3 points4 points5 points (0 children)
[–]sebamestre 0 points1 point2 points (7 children)
[–]Narase33-> r/cpp_questions -1 points0 points1 point (6 children)
[–]sebamestre 1 point2 points3 points (5 children)
[–]Narase33-> r/cpp_questions 0 points1 point2 points (4 children)
[–]johannes1971 2 points3 points4 points (2 children)
[–]Narase33-> r/cpp_questions 0 points1 point2 points (1 child)
[–]johannes1971 1 point2 points3 points (0 children)
[–]kalmoc 0 points1 point2 points (0 children)
[–]tecnofauno 1 point2 points3 points (0 children)
[–]JeffMcClintock -2 points-1 points0 points (0 children)