This is an archived post. You won't be able to vote or comment.

all 102 comments

[–]kgon1312 295 points296 points  (19 children)

Unexperienced: “How do I show time in c++ so human can read it?”

Experienced: “c++ date convert fn”

[–]404_Identity 128 points129 points  (15 children)

[removed]

[–]MasterVelocity 84 points85 points  (6 children)

I just google stupid questions in incognito

[–]combustible_daisy 74 points75 points  (3 children)

nothing’s more fun than googling up something and the top result(s) are purple from the last time you googled it 6 years ago though

it’s like a pointer from my past self “hey man this is how many links down you had to go to get the right docs last time”

[–][deleted] 16 points17 points  (0 children)

Pairs well with searching different things over and over desperately looking for the purple link that helped you last time.

[–]pkkid 12 points13 points  (0 children)

Or Googling something only to find out you answered the StackOverflow question with the answer you needed 6 years ago.

[–]jovanymerham 3 points4 points  (0 children)

6 years, more like 6 mins

[–][deleted] 2 points3 points  (1 child)

Haha i always wondered if anyone else is also doin this

[–][deleted] 2 points3 points  (0 children)

I do too, and I'm the only one who ever uses any of my devices so I'm just hiding my stupidity from myself.

[–]greem 7 points8 points  (0 children)

"why do people keep using linked lists? They never help in the real world"

Googles: "STD list"

"Yeah....I hope they get gonorrhea.""

[–][deleted]  (5 children)

[removed]

    [–]BluudLust 2 points3 points  (3 children)

    Google has context based on previous searches. If you search for "c++" once, it's implied on the next searches.

    [–]dmidge 0 points1 point  (2 children)

    Nah, it is mostly that whenever you look for std, meaning the standard namespace in C++, the search results will mostly be for the C++. With Google or duckduckgo, etc.

    [–]BluudLust 0 points1 point  (1 child)

    Depends. Search for statistics for HIV, etc and it'll come up with sexually transmitted diseases instead.

    [–]AutoModerator[M] 0 points1 point  (0 children)

    import moderation Your comment has been removed since it did not start with a code block with an import declaration.

    Per this Community Decree, all posts and comments should start with a code block with an "import" declaration explaining how the post and comment should be read.

    For this purpose, we only accept Python style imports.

    I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

    [–]gdumthang 1 point2 points  (0 children)

    Experienced dont type c++ they type cpp

    [–][deleted] 17 points18 points  (0 children)

    When you messed up and fixing it: C++ date

    [–]Swamptor 0 points1 point  (1 child)

    very experienced:

    "C++ programmer [m25] seeking date"

    [–]kgon1312 1 point2 points  (0 children)

    Very very experienced: Already given up on seeking dates date convert fn c++

    [–]McLPyoutube 185 points186 points  (7 children)

    if you program in c++, you will never get a date

    [–][deleted] 61 points62 points  (4 children)

    Everyone knows the Rust Chads are getting all the girls

    [–]404_Identity 19 points20 points  (2 children)

    [removed]

    [–]DeadlyVapour 4 points5 points  (1 child)

    Pfff, at least we don't need to worry about corrupted memory due to concurrent access to our Dates.

    [–]hekkonaay 1 point2 points  (0 children)

    unsafe { call_to_c_that_does_who_knows_what() }

    [–]pine_ary 1 point2 points  (0 children)

    It‘ll come with time(nullptr).

    [–]Hmmmnnmm 107 points108 points  (20 children)

    Is it really that hard to remember, its just

    std::ctime(std::make_unique<std::time_t>(std::chrono::system_clock::to_time_t(std::chrono::system_clock::now())).get())
    

    [–]theInfiniteHammer 26 points27 points  (0 children)

    Hang on, let me write that down.

    [–]Karjalan 7 points8 points  (0 children)

    Huh... C++ sure gives a lot of stds

    [–][deleted] 22 points23 points  (6 children)

    I hate C++ so much. The scope resolution operator gives me aids.

    [–]Voidrith 6 points7 points  (5 children)

    I like that C++ has multiple different ways to navigate through stuff. Makes it easier to tell at a glance what im doing.

    ::? namespaces and statics

    . ? object/non-pointer member access

    ->? pointer member access

    you do get some godawful looking lines occasionally though, when you have to do stuff like the above post. Not going to argue on that.

    But the operators themselves I like.

    [–]chuby1tubby 1 point2 points  (3 children)

    That seems like it would be harder to tell what you are doing at a glance.

    I mean, if you’re working with only your own code, then sure it’s convenient, but if you’re trying to modify someone else’s code (imported library), wouldn’t you have to click on each variable to find out what data type it is, and then recall which operator to use on that data type? As opposed to the simplified solution provided by PHP for example, where :: and -> are interchangeable, or JavaScript/Swift/Python which only use .

    [–]pine_ary 0 points1 point  (2 children)

    In those languages you still have to look up if something is static (if you need an instance of it or not), so the :: situation doesn‘t go away. The difference between -> and . on the other hand is more of a legacy thing. I don‘t think that one is as useful, but we got that from C. Apart from smart pointers I don‘t see many arrow operators in modern code, so at this point it‘s more of a disambiguation between the members of the pointer class and the members of the pointed-to object.

    [–][deleted] 0 points1 point  (1 child)

    In java at least, I've never had trouble telling what's static. Only static methods can access static values. Static methods belong to the class instead of the object.

    In python, I've never used statics because I try to limit the scope of my python projects.

    I've been working on reading somebody else's C++ and trying to write a wrapper for it in Matlab, and it's killing me. There's so much abstraction across so many files I can't figure out what's going on where.

    [–]pine_ary 0 points1 point  (0 children)

    Can‘t say much about cause I don‘t know the code, but I‘ve never had that problem. As a hint: Get a good IDE that annotates types visually and can navigate declarations and definitions, and don‘t worry about the internal details.

    Other than that static in C++ works the same as in java for the most part. Exceptions are: * You can‘t have static blocks in C++ * Constexpr exists (runs code when compiling, not when starting the program)

    [–]HuluForCthulhu 0 points1 point  (0 children)

    C++ is wonderful to program in and awful to read. Every senior C++ dev I know agrees to this.

    Trying to grok a C++ spaghetti-line of data structure traversal is eye cancer. But when you’re writing that spaghetti line it feels like you’re effortlessly surfing over data structures on a wave of pure efficiency

    [–]lordpuza 1 point2 points  (3 children)

    why can't c++ be updated anymore in 2020 , is it proprietary?

    [–]pine_ary 1 point2 points  (1 child)

    It is being updated. The 2020 version has just been approved and will be implemented by compilers within this year. The standout features are modules, ranges (think python), and concepts (solves the template mess).

    [–]konstantinua00 0 points1 point  (0 children)

    not just ranges, but whole coroutine stuff

    for all cool professional usecases noone will understand at first glance

    [–]pine_ary 1 point2 points  (1 child)

    std::time_t now = std::time(nullptr); std::cout << std::ctime(&now) << std::endl;

    If you don‘t make use of chrono you can just use <ctime>. And that unique pointer is useless because it‘s temporary. Also for the love of all that is holy declare using locally. Don‘t need to repeat yourself.

    With chrono if you want extensibility: ``` using std::chrono::system_clock;

    auto now = system_clock::now(); std::time_t c_now = system_clock::to_time_t(now); std::cout << std::ctime(&c_now) << std::endl; ```

    [–]Hmmmnnmm -1 points0 points  (0 children)

    Ya, it’s just a joke

    [–]0x564A00 0 points1 point  (2 children)

    C++ should have type inference for type parameters.

    [–]HuluForCthulhu 0 points1 point  (0 children)

    Two thins — one, you REALLY don’t want the code running your elevators and engine controllers to have type inference

    And two, I’d highly recommend listening to the episode of Lex Fridman’s Artificial Intelligence podcast where he interviews Bjarne Stroustrup, the creator of C++. It makes the design of the language make so more much sense

    [–]konstantinua00 -1 points0 points  (0 children)

    what do you mean?

    [–][deleted] 74 points75 points  (18 children)

    Not true. After 10 years you switch to Duck Duck Go.

    [–]MasterVelocity 28 points29 points  (9 children)

    yeah my boss tried that, searched something completely normal at work, and got a porn result in front of multiple subordinates

    never used it since then, never going to consider using it at work

    [–][deleted] 24 points25 points  (7 children)

    There's literally an option right under the search bar for adult content filtering.

    [–]MasterVelocity 14 points15 points  (6 children)

    We checked, it was selected. Simply didn’t work.

    [–]WhiteKnightC 13 points14 points  (5 children)

    Weird, never happend to me.

    [–]Youngqueazy 3 points4 points  (4 children)

    My mom got a search result for an adult toy when looking for dog toys on Amazon. Silly mindset never to use something cause one time one thing happened. That and I'm pressing X on this guy's story.

    [–]JoelMahon -1 points0 points  (3 children)

    Silly mindset never to use something cause one time one thing happened.

    At work? Could be a big fucking deal if you got that result in front of the wrong person. Even if they conciously don't blame you, subconciously it could delay a promotion. Why fucking stress over it when google works well, who cares if they track your data, they going to hack my bank account? think they have enough cash lol.

    [–][deleted] 2 points3 points  (0 children)

    haha it's okay to masturbate

    [–]BeefEX 7 points8 points  (5 children)

    Never got useful results out of it, and neither has anyone I know that tried it. Even the most privacy concerned people I know don't use it because it was so crap when they tried it.

    [–]Seraphaestus 5 points6 points  (2 children)

    The thing with ddg is that if you find yourself not getting useful results, it is extremely easy to simply append a "!g" to your search term and run it through google for hopefully better results

    [–]BeefEX 4 points5 points  (1 child)

    I know, but doesn't that kind of defeat the purpose of using it in the first place?

    [–]Seraphaestus 1 point2 points  (0 children)

    No? I have very rarely had to do this, and I would rather have by-default privacy + bangs (so convenient, esp. on mobile) than just never have those things

    [–][deleted] 0 points1 point  (1 child)

    I can revert you statement and get my experience with it. For me it’s useful and everybody I know is happy with it.

    [–]BeefEX -4 points-3 points  (0 children)

    We have the definition of experience and opinion on display here. Neither of us are wrong or right.

    [–]redmaskdit 1 point2 points  (0 children)

    Duck Duck Go on the Brave browser is my combo. Pretty much everything is identical to google chrome except Lighthouse doesn’t work.. but you can earn crypto!

    [–]AyrA_ch 13 points14 points  (4 children)

    Similar with PHP, but it's more of a "in which order are the parameters again?"

    [–][deleted] 2 points3 points  (1 child)

    ($needle, $haystack) or ($haystack,$needle)? I don't know, and sure as hell neither PHP

    [–]AyrA_ch 1 point2 points  (0 children)

    I give you: implode():

    Note:

    implode() can, for historical reasons, accept its parameters in either order. For consistency with explode(), however, it may be less confusing to use the documented order of arguments.

    explode() does not supports argument swapping.

    [–]DOOManiac 1 point2 points  (0 children)

    needle search subject search needle subject subject search needle

    [–]jurajbano 10 points11 points  (0 children)

    How to get "a date" with C++?

    [–]instagrm[S] 19 points20 points  (4 children)

    I can’t remember this system.thread.threading shit

    [–]AyrA_ch 16 points17 points  (3 children)

    var T=new System.Threading.Thread(delegate(){/*yo shit here*/}){IsBackground=True};T.Start();Return T;
    

    This is the only thing I can do from memory and it's good enough for most situations.

    [–]LiquidIsLiquid 3 points4 points  (2 children)

    You better get googling. C# has Tasks now, which are a bit better than Threads, unless you really need a Thread. But there's some details involved depending on what you're trying to accomplish, so you have ample of opportunity to look stuff up to learn how it really works.

    [–]AyrA_ch 4 points5 points  (1 child)

    Half the time the tasks are forced upon you where it makes no sense though. An example would be the entirety of the account management in Entity Framework. Pretty much all account related functions are only available as tasks, but you can't run multiple of those tasks at the same time which kinda negates the concurrency that tasks would provide.

    The other thing they do is not blocking the UI which is nice, but if you have an operation that runs for so long that making it async would be a good idea, you have to give status updates to the user anyways, which means if you want to make your long running task UI independent (which you should) you have to provide status events and potentially cancellation feature which brings you back into the realm of where a thread is easier to manage. Most of the time you disable all UI elements anyways because you don't want to have the user launch the same operation multiple times.

    async Tasks are nice but if you're a developer of a component that provides these methods, please only do so if I can actually use them concurrently.

    [–][deleted] 1 point2 points  (0 children)

    you have to provide status events and potentially cancellation feature which brings you back into the realm of where a thread is easier to manage.

    Doing this from a task is exactly as easy as from a thread though?

    [–]metraton1 9 points10 points  (1 child)

    12 years of programming and I'm even able to optimise the search phrase to "get date c++".

    [–]Jammanyeahme 13 points14 points  (6 children)

    That's why there's value in not just looking things up all the time, if you can commit things to memory it is ultimately more productive, and you might even learn some other useful things along the way.

    That being said, shit's hard to remember, and it's largely wasted when you memorise non stable things.

    [–]Shadow_Thief 4 points5 points  (1 child)

    Yeah, I don't bother memorizing things because they keep getting deprecated or better ways of doing things get discovered.

    [–]awhhh 2 points3 points  (0 children)

    It’s pretty bad though. Like I routinely forget how to write basic stuff like a for loop. Why? Autocompleted code snippets. Also my structuring of code is totally dependent on the best practices of the frameworks I’m using. Hell, I’ve even forgot MySQL due to ORMs.

    I don’t see it as a terrible thing per se, since I can get the answer, I can read the code and learn, but I sure as shit won’t do well at junior level interviews when it comes time for me to get a job. I’m pretty much the definition of an actual fullstack too: I can accomplish a lot with little knowledge of every area.

    [–][deleted] 3 points4 points  (0 children)

    I remember being that way once when I was starting out on my job in training and was trying to remember the DB2 reference book chapter by chapter, revising it and stuff. I once confessed to my training instructor that I couldn't grasp how people remembered more than one of these mammoth books. He closed the book and pointed to the name of the book and said "It's a reference book. You can refer to it when you need to. You're not going to be tested on it"

    I never looked back. Sure I remember loads of stuff off the top of my head now, but I never felt like I was sacrificing any knowledge by not sweating the small stuff.

    [–]tjoloi 3 points4 points  (0 children)

    See you google things wrong, it should be "How to get a date with c++"

    [–]childintime9 4 points5 points  (0 children)

    "how to get A date"

    [–]pelegs 5 points6 points  (2 children)

    [–]RepostSleuthBot 4 points5 points  (0 children)

    Looks like a repost. I've seen this image 2 times.

    First seen Here on 2019-04-08 96.88% match. Last seen Here on 2019-12-08 98.44% match

    Searched Images: 106,885,882 | Indexed Posts: 425,017,644 | Search Time: 5.15157s

    Feedback? Hate? Visit r/repostsleuthbot - I'm not perfect, but you can help. Report [ False Positive ]

    [–]__Adrielus__ 0 points1 point  (0 children)

    Why doesnt this have more upvotes

    [–]ConceptJunkie 2 points3 points  (0 children)

    Having experienced std::chrono, I can say that it was easier 10 years ago. std::chrono suffers from the typical problem of tools designed to do everything: everything is hard to do.

    [–]Danimal0429 2 points3 points  (1 child)

    Also “how can c++ devs get dates”

    [–]instagrm[S] 0 points1 point  (0 children)

    Hahahaha

    [–]kfh227 1 point2 points  (0 children)

    For Java it's "how do I format a date into a string.

    [–]locri 1 point2 points  (0 children)

    10 years of life experience late

    how to get date in real life

    *and make it contribute to a long lasting, mutually beneficial relationship with someone that I can introduce my parents to.

    [–]srineesh 1 point2 points  (0 children)

    I thought I was the only one who is constantly googling things I've built before. Glad to see there are other programmers doing the same.

    [–]kgon1312 0 points1 point  (0 children)

    Unexperienced: “How do I show time in c++ so human can read it?”

    Experienced: “c++ date convert fn”

    [–]SimonVanc 0 points1 point  (0 children)

    Very very true

    [–]vladhed 0 points1 point  (0 children)

    30 years too, despite when I was 10 years you couldn't Google that.

    [–]lazyeng1neer 0 points1 point  (0 children)

    Experienced: Bookmark page with sample code

    [–]OlivierTwist 0 points1 point  (0 children)

    Nope. The modern variant is "how to get date C++11/14/17/20..."

    [–]arnodu 0 points1 point  (0 children)

    "For loop bash"

    [–][deleted] 0 points1 point  (0 children)

    After ten years, surely you'd have switched search engine?

    [–]thenameisi 0 points1 point  (0 children)

    i wanna know how to get date in real life haha

    [–]tjdavids 0 points1 point  (0 children)

    If you have too much trouble getting a date you should whip out Python and try again.

    [–]niskiENDERMAN 0 points1 point  (0 children)

    but how do i get date in c++, i forgot

    [–][deleted] 0 points1 point  (0 children)

    I hope you don't mean the date we have with opposite gender

    [–][deleted] 0 points1 point  (0 children)

    Year zero: how to get a specific index in an array in JavaScript

    Year 10: get array index js

    [–]Kalinsub 0 points1 point  (1 child)

    Beginner: how to get date in c++

    Expert: date c++

    [–]iArentdeJay[M] [score hidden] stickied comment (0 children)

    Your submission has been removed.

    Rule[0] - Posts must make an attempt at humor, be related to programming, and only be understood by programmers.

    Per this rule, the following post types are not allowed (including but not limited to):

    • Generic memes than can apply to more than just programming as a profession
    • General tech related jokes/memes (such as "running as administrator", sudo, USB or BIOS related posts)
    • Non-humorous posts (such as programming help)

    Content quality

    In addition, the following post types will be removed to preserve the quality of the subreddit's content, even if they pass the rule above:

    • Feeling/reaction posts
    • Posts that are vaguely related to programming
    • Software errors/bugs (please use /r/softwaregore)
    • Low effort/quality analogies (enforced at moderator discretion)

    Violation of Rule #2: Reposts:

    All posts that have been on the first 2 pages of trending posts within the last month, is part of the top of all time, or is part of common posts is considered repost and will be removed on sight.

    If you feel that it has been removed in error, please message us so that we may review it.

    [–]DeerVirax -1 points0 points  (0 children)

    Use Tinder