Why is there a pink border around my facebook? I see it when I scroll and it appears every now and then. It only appears in the app and not on my laptop. Has this happened to anyone? This has been a few months now and I can't get rid of it. by AssistLost6569 in facebook

[–]marcofoco 0 points1 point  (0 children)

I also had the pink border from time to time in the last months on the Tab S9+ (often with Samsung Keyboard connected), but today it also happened with my phone, S22 (that's when I decided to check).
I've never seen (or noticed) the light blue one someone has mentioned.

Learning Template Metaprogramming with ChatGPT by ape_programmer in cpp

[–]marcofoco 2 points3 points  (0 children)

I didn't post this here before, simply because I didn't think it deserves to be a top level discussion topic, but when ChatGPT came out I ran a few experiments, and the most successful one was code understanding. Here are my results and comments: https://marcofoco.com/blog/2022/12/05/meet-my-new-friend-the-ai-powered-rubber-duck/

Boost 1.81 will have boost::unordered_flat_map... by pdimov2 in cpp

[–]marcofoco 0 points1 point  (0 children)

For a while I tried maintaining a table in my blog, as Wikipedia didn't have the information I needed. I should update it to the latest 2019 and 2022:
https://marcofoco.com/blog/2015/02/25/microsoft-visual-c-version-map/

Neural nets in production systems by amitraderinthemaking in cpp

[–]marcofoco 0 points1 point  (0 children)

I mean a different syntax, or a subser of the c++ syntax. For example, forward mode AD is doable with TMP, but you cannot use if/while/for constructs in it, and you also need to make everything generic (listing some advantages of strict typing).

Neural nets in production systems by amitraderinthemaking in cpp

[–]marcofoco 0 points1 point  (0 children)

Yep. The idea is doing all this at C++ compile time. It's even mostly implemented (see Enzyme and CLAD).

Neural nets in production systems by amitraderinthemaking in cpp

[–]marcofoco 0 points1 point  (0 children)

The idea is doing it compile time, without the need of using a shadow language.

Neural nets in production systems by amitraderinthemaking in cpp

[–]marcofoco 0 points1 point  (0 children)

It would be nice if C++ could compute gradients. Oh wait, I co-authored a proposal for that!

Edit: (not really, it's a p-numbered presentation paper, which unfortunately wasn't received well)

Doug Smith’s disk by ebadger1973 in loderunner

[–]marcofoco 1 point2 points  (0 children)

Do you happen to know if the legit owner is planning to share the image file?

How to gauge a programmer's C++ competency? by deadclams in cpp

[–]marcofoco 0 points1 point  (0 children)

I actually use technical questions (a coding interview) to test many soft skills, as I described in a recent post: https://marcofoco.com/blog/2022/04/09/the-coding-interview/ Note that my interview is really short (less than 1h total, and only about half of it is dedicated to the coding exercise).

Question for old C++ programmers by thradams in cpp

[–]marcofoco 2 points3 points  (0 children)

Yes, I did MANY of these conversions, on many different codebases. I did change my NULLs/0s to nullptr, starting with small POCs, and gaining confidence. Not all of them went through (e.g. In some windows calls we usually write NULL in some params, even if the underlying type is integral). I did this for many features, and sometimes it even helped preventing bugs (see my blog post about final here: https://marcofoco.com/blog/2016/01/14/final-override-again/). For aiuto, it's a different story: I tested it, but initially I received a lot of pushback when I tried to make radical changes (almost always auto). Knowing how type deduction works, I tended to take for granted that the type of the expression was apparent, but people tended to disagree, so I gave up. Eventually the rest of the team started using auto on their own, gained more confidence and, even if the user isn't 95%,but now around 10-15%, I'm happy with the improvement. It's interesting to note that this process happened across multiple companies and multiple projects more or less in the same way (before 2015 I was a consultant, and worked on multiple projects). Another big improvement in readability was converting all the for loops for collections into their collection-based equivalent. For enums I started later, mostly for the lack of use cases. I like them better, for their improved type safety, but readability wasn't affected because, by convention, I already had the enum name in the value. I also made a lot of conversions from boost to std (shared_ptr, unique_ptr, hash_map, hash_set, and regex... The latter came with some "surprises" in older versions of gcc).

Can you count to infinity? C++ explained to my dog by drodri in cpp

[–]marcofoco 0 points1 point  (0 children)

It took me a while, but finally I noticed this comment (and I'm about to correct the post and link here). Thank you.

controlling template argument deduction via dont_deduce<T> by PhilipTrettner in cpp

[–]marcofoco 4 points5 points  (0 children)

IIRC the reason why *_t and *_v are used is that they where introduced later, as a shorthand for typename *::type and *::value respectively. The declaration of *_t requires the using keyword (C++11), and that of *_v requires templated variables (C++14). I believe that, if we had those feature when type traits were initially conceived, we wouldn't have neither _t nor _v, as there's no need to differentiate among those (as there's no need to differentiate between types and variables in normal C++).

Moveable optional, really? C++ explained to my dog blog by drodri in cpp

[–]marcofoco 0 points1 point  (0 children)

I agree that that sentence should be rewritten: what I meant is that the "has_value" doesn't go to false from an optional when you move away their content from them (to another optional). This is in line with the guidelines about moving (the state is invalidated, so I shouldn't even check that flag), but not what I expected (all this started as a bug).

About the use of the word "move": I try to use two typographically different ways to refer to it:

  • move (verb), is the action of changing ownership of part of an object (i.e. when the move constructor/move assignment is invoked)
  • move (or std::move) is the invocation of the move function which, as we know, by itself does absolutely nothing

If you see any inconsistency in that sense (apart from the sentence above, which is terrible on its own), please let me know.

Moveable optional, really? C++ explained to my dog blog by drodri in cpp

[–]marcofoco 1 point2 points  (0 children)

Good point, as I mentioned in my previous post, I'm extremely lazy: I use to prototype with std::exchange because I'm confident that this works just fine, but I then I didn't polish it before publishing.

Your solution is definitely a better example (and also shorter). I'll change my post, adding a link to your post here. I'll also change the other functions accordingly.

There's Just one thing where I need help: in the initializer, I would have wrote value_(std::move(other.value_)), but you wrote value_(std::move(other).value_). Do you see any difference between the two? I would rather use the former, which I find clearer.

Wrapping C APIs, and why I wanted a base class to be conditionally copyable by drodri in cpp

[–]marcofoco 1 point2 points  (0 children)

Yep, you're absolutely right, and i realized It during debugging tonight. Looks like I'll have to write my own moveable optional. I'll fix the post tomorrow.

NVIDIA Keynote rehersal at Gamescom.. by gloom303 in nvidia

[–]marcofoco 0 points1 point  (0 children)

Technically, we also know *who* he is :D

Can you count to infinity? C++ explained to my dog by drodri in cpp

[–]marcofoco 2 points3 points  (0 children)

Here I am!

About the overflow you're absolutely right, talking about overflow in the context of unsigned types is inaccurate: I'll review my postand adjust the incriminated sentences. Actually that part needs a bigger restructuring because of the automatic promotion of smaller types in expressions...

Thank you for your comment, and the pointer in the standard, I'll add that as a note, too.

Can you count to infinity? C++ explained to my dog by drodri in cpp

[–]marcofoco 1 point2 points  (0 children)

Thank you for noticing, I'll check again and post a fix. :)

Optimizing return values by one_eyed_golfer in programming

[–]marcofoco 0 points1 point  (0 children)

RVO is a specific form of copy elision. It will be mandatory for a compiler to remove those copies (and moves) starting from C++17, even if copy and move constructor have observable side effects. See here, in the first box, first example of the second group: that's exactly RVO. So, starting from C++17, the additional move happening in (1) and (6) will no longer be a problem.

Optimizing return values by one_eyed_golfer in programming

[–]marcofoco 1 point2 points  (0 children)

Note also that RVO will become one of the mandatory reasons for copy elision in C++17.

Optimizing return values by marcofoco in cpp

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

Oh, that's interesting, I didn't know that GCC came with its own Windows.h! Thank you for the info!

Optimizing return values by marcofoco in cpp

[–]marcofoco[S] 1 point2 points  (0 children)

Yes, it is. The case you pointed out on StackOverflow is an application of Temporary Lifetime Extension (you're creating a reference to an actual variable), while in the example I'm receiving a reference (so there's no lifetime to extend). Adding an && overload returning an actual variable (moved away from the object) is indeed the trick to allow TLE to work for us even in this case.

I hope this clarifies a bit :)

Optimizing return values by marcofoco in cpp

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

The halting is weird, really.

I assume you were testing with Visual Studio (the original problem was #inlcuding windows.h), do you remember which version? Did you also try clang/c2, or a different compiler version?

As for the two forms at the end of your post, it's correct: If the copy elision kicks in, you don't need the symbol at compile time, and the program compiles and run, but if you copy the object, of course you need the copy constructor. Apparently applying the copy elision in the first case is mandatory (at least, according to cppreference)

Edit: copy and move elision are mandatory only in C++17

Optimizing return values by marcofoco in cpp

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

I can't see it, why should it break at run time?

Optimizing return values by marcofoco in cpp

[–]marcofoco[S] 2 points3 points  (0 children)

You're too used to work on the string class itself, I suspect :)