« first day (815 days earlier)      last day (4359 days later) » 

Xeo
Xeo
14:00
Nah, my pinky is tuned for the ctrl where it's now.
@Xeo Say hello to RSI pinky in 10+ years.
Actually, it's probably ok since you're not using emacs.
Xeo
Xeo
@StackedCrooked I don't particularly strain it or anything.
In the unstrained position, my pinky is just between shift and ctrl.
Mine is one the A.
Reaching Ctrl requires a little straining.
Xeo
Xeo
@StackedCrooked I always have my hand on WASD basically, so that wouldn't work. :)
14:05
16
Q: shared_ptr by reference or by value?

DanvilWhen a function should take a boost::shared_ptr, are you passing it by const reference void foo(const boost::shared_ptr<T>& p) or by value void foo(boost::shared_ptr<T> p) ? I would prefer the first method because I suspect it to be faster. But is this really worth a though or ...

9
Q: Should I pass a shared_ptr by reference?

Ben CrowhurstWhat are the best practices for passing a shared_ptr? Currently I pass shared_ptr function arguments like so: void function1( shared_ptr<TYPE>& value );

Hm, not a single answer says "instead of passing a shared_ptr by value or by reference, consider passing the raw pointer by value". Should we intervene? :)
@Xeo Wow, your pinky is mighty short.
@Rapptz I'm here, yooo
@FredOverflow Yes, close as dupe.
.... Woops.
Maybe I should bind Ctrl to A. But then I don't have A anymore.
14:06
I mean, we have come to the conclusion that passing a shared_ptr by const reference is pretty much nonsense, right?
Which might cause problems.
Xeo
Xeo
@R.MartinhoFernandes What? No.
@R.MartinhoFernandes That's not what I intended.
@FredOverflow I pass it by const ref.
@FredOverflow Dupe of the question with my answer.
14:06
@sehe I had to find out why it was producing different results. I needed to know.
The truth was at stake here.
Xeo
Xeo
@StackedCrooked Doing it wrong, obviously.
Lives were in the delicate balance of Good versus Performance.
@ThePhD erm. wut. context?
@R.MartinhoFernandes linky please
@Xeo Well passing it is usually wrong to begin with.
14:07
@FredOverflow The accepted answer here mentions passing by value.
@sehe DirectXMath and it's direty "negation = 0 - (value)"
43
A: Passing shared pointers as arguments

R. Martinho Fernandes I want to pass a shared pointer to a function. Tell me how to do that. I can only think of two reasons to take a shared_ptr argument: The function wants to share ownership of the object; The function does some operation that works specifically on shared_ptrs. Which one are you interested...

@StackedCrooked Which control key do you use?!
@sehe The left one.
user142019
Yay lecture is about to start.
user142019
14:08
How fun.
user142019
I'm so excited.
> Shortly, there is no reason to pass by value
:(
Fuck you Herb.
@Zoidberg .... Zoiberg why you no have '-- at the end of your name anymore? :c
user142019
Because it was boring!
@ThePhD mkay. Pro tip: use 'reply to this message' to prevent cognitive dissonance from drowning out actual message content :)
14:08
@sehe Sorry. :c
@Zoidberg apparently so. You have been talking about this for >24 hours
user142019
My Markdown-to-RTF convert is done and has all the features I need.
@R.MartinhoFernandes Passing by value the shared_ptr, right. But what about passing by value the raw pointer?
user142019
Headers and paragraphs. xD
ahhhhhh, hence why I could never find MSCV source files in it's own project folder
14:09
@Zoidberg So now you wear boring lectures at the end of your name
Add existing was actually going for the files I linked, I assumed it copied them over to the new project
@FredOverflow Oh, that.
@GigaBass MSCV?
MVS*
I don't know why in hell I say mscv lol, don't even know what it is
I file that under the "pass-pointee-by-reference" umbrella for when nullability is important.
14:09
mCSV - text files with field delimited by microscopic commas
Oh right, mcsv
@R.MartinhoFernandes I say: pass by value the shared_ptr if you want to share, or pass by value the raw pointer. Passing a shared_ptr by const reference seems entirely useless to me, and I think lots of people in the Lounge agree.
Xeo
Xeo
57
Q: Which kind of pointer do I use when?

sbiOk, so the last time I wrote C++ for a living, std::auto_ptr was all the std lib had available, and boost::shared_ptr was all the rage. I never really looked into the other smart pointer types boost provided. I understand that C++11 now provides some of the types boost came up with, but not all o...

@R.MartinhoFernandes That was an obvious cue for linking, right?
@R.MartinhoFernandes Can shared_ptrs not be null? :)
@FredOverflow Yes.
Erm.
Xeo
Xeo
14:11
@FredOverflow Err... was that serious?
Is that a trick question?
Also, Fred just cost me a zillion rep in downvotes.
What? Why?
Xeo
Xeo
lol
@FredOverflow Downvoting all the bad answers.
Because this is a pet peeve of mine and I am downvoting every single answer that follows or suggests the same as Herb's wrong advice.
@R.MartinhoFernandes What does "yes" mean here? From what I reckon, a shared_ptr can be empty.
14:14
@FredOverflow It can also be non-empty...
Should we invent an empty_ptr that can only be empty? :)
user142019
std::nullptr_t?
Xeo
Xeo
shared_ptr for nullability, aka optionality just seems wrong.
@FredOverflow Yes.
@FredOverflow If I write void f(ref_or_ptr_we_will_discuss<T> t), it is irrelevant whether shared_ptr can be null or not.
14:15
@Xeo Implicit nullability is always wrong, it's just that we've gotten used to it.
The cue is that there is no shared_ptr in the interface.
@Xeo It seems we share the same optionality.
If the function can take nulls, it should take pointers.
If it can't it should take references.
Simple.
Xeo
Xeo
Aye
As with most things, smart pointers change nothing...
14:15
Your pointer is null!
It is always the same old rules!
Xeo
Xeo
> Prefer references and use raw pointers when you need either nullability or resettability.
Why did Stroustrup name references references instead of aliases?
Because "aliases" was already taken for the bestest feature ever.
Xeo
Xeo
Is that an intro to a joke?
14:17
Oh wait.
@Xeo lol no, genuine question
I think I need to fix my time machine.
Xeo
Xeo
@R.MartinhoFernandes I want a true alias keyword. :/ alias foo = bar would have exact same template arguments. It's currently impossible to do this generically because of non-type template parameters.
It's Fred's fault.
Xeo
Xeo
lol, the git submodule question...
14:19
@Xeo That thing is huge.
Over 700+ score I think.
I don't even check anymore.
And unlike other highly voted stuff on the site, I am getting every single drop of blood rep from it, since it comes in one or two upvotes a day.
Xeo
Xeo
716
I think I remember when it hit 100 or 200
@Xeo Doesn't D have an alias keyword? Or was that Scala?
Xeo
Xeo
I still need 2 stupid upvotes on my sum answer.
Why do you "need" them?
Xeo
Xeo
Gold badge
14:23
Not a scam: If you’ve committed a burglary in the #Leicester area within the last week - come to our #police station & claim a FREE iPad.
Their size when wrapped in a class becomes pointer size.
@FredOverflow Because the chicken already had crossed the road
@StackedCrooked I use that to get their alignment in my tuple implementation.
"Not a scam"
Right
Xeo
Xeo
14:24
@StackedCrooked Well, what else would you want them to be?
@StackedCrooked Huh. What else
Is c17 a Dragon Ball reference?
I know. Still it's odd IMO. Never mind..
Xeo
Xeo
@R.MartinhoFernandes o_o
@R.MartinhoFernandes No, just something random.
14:26
IMO, sizeof(reference_member) should give the compiler warning "Thou shalt not think of references as pointers!"
@Xeo I see references everywhere!
Wait, doesn't sizeof(reference) give you the size of the referee?
@FredOverflow It does.
The reference is the object.
But not for reference members?
@FredOverflow The code is asking the size of the struct.
If your write sizeof(wrap<c17>(ref).t) you get 17.
14:27
Right, so sizeof(bool&) is 1.
Xeo
Xeo
It's sizeof(bool), though.
Well, it is on VS2012, that's all I care about :)
Let me try again: sizeof(char&) == 1, right?
And what crappy implementation uses more than one char for a bool?
sizeof(bool) is unspecified?
Xeo
Xeo
@StackedCrooked Just like the exact size of every integral type except the char family.
@FredOverflow For some reason I used to think it was 2. Don't know why lol.
@StackedCrooked Maybe because it has 2 values, true and false? :)
@FredOverflow That makes perfect sense!
14:30
Because it's wide bool
wbool_t
2
Is boost::optional specialized for bool so boost::optional<bool> only takes 1 char?
Xeo
Xeo
@FredOverflow Don't forget FILE_NOT_FOUND, so we need three values, which is 0010 in binary which is 2 in decimal. Maybe from that? :)
@Xeo 0010 is 2, not 3...
WTF are you high on?
@FredOverflow no, AFAIR
Xeo
Xeo
14:32
@R.MartinhoFernandes to store three values, you only need up to 0010 .. 0000, 0001, 0010. It didn't come across like that, though, huh?
@sehe I don't want to live in this world anymore!
@FredOverflow No. optional<bool> is not desirable because there is tribool which has better semantics.
@FredOverflow How do you store none then?
@CatPlusPlus false = 0, true = 1, none = 2?
@FredOverflow FYI
14:32
Derp
Nevermind
Xeo
Xeo
@StackedCrooked As expected.
the thing about three-value bool is AND=min() and OR=max()
The thing is optional<bool> b = false; assert(b);...
as I recall boost's tribool is ungood wrt. that
@Cheersandhth.-Alf ...as in two-valued boolean algebra :)
@FredOverflow Hmm. I haven't actually looked at that. I half-remembered my storage efficiency tests for variant/tuple:
Oct 20 '12 at 22:07, by sehe
@LucDanton should std::tuple<> potentially be POD? I'm trying to explain for myself why sizeof(T=std::tuple<char,char,char>)==sizeof(struct X{char x[3];}), but sizeof(variant<T>) == 16 and sizeof(variant<X>) == 8 here
@FredOverflow What about FILE_NOT_FOUND?
@StackedCrooked 3
oh shit, Performance Analysis D:
14:34
Anyway, gotta write some function templates. See you later, guys.
@sehe IIRC Once you have a constructor it's no longer a POD. Unless you have a "defaulted" constructor. But then the value initialization doesn't work anymore (doesn't initialize member values). (My experience with GCC 4.6, not sure if bug.)
user1182183
hm guys where do I set in Visual Studio to use '' for __T(a) instad of 'L' ?
@StackedCrooked Not a bug. A POD must have trivial initialization.
@GamErix to use what for what instead of L?
Xeo
Xeo
14:38
@GamErix multi-byte to ascii
user1182183
@melak47 well let's say VS assumes default wchhar_t
user1182183
I want to use just char
Just write "?
@GamErix Why would you do that? Are you planning to build your code for Windows 98 and Me?
Xeo
Xeo
project properties -> General -> Character Set
14:38
> C isn't meant for writing custom syntactical sugar all day, that's what C++ is for. C is for getting shit done.
user1182183
@JerryCoffin community standarts
Xeo
Xeo
@ThePhD AHAHAHAHA
GameDev room is serious business.
@ThePhD Emphasis on "shit".
14:39
@GamErix You are part of a community that builds code for Win98 and ME?
user1182183
@R.MartinhoFernandes SA-mp ;> and no there no need for special chars
Why does task manager show CPU usage @ 2% while the performance analysis shows ~15%? Is it per-core or such?
You can't get shit done with C.
@GamErix Apparently not supporting them is more trouble...
@GamErix Amazing. So much to learn
@GigaBass probably just lag :) Windows, and all
user1182183
14:41
@R.MartinhoFernandes I would like to use wchar_t but then the library won't compile / be compatible with the scripts etc which already exist
@StackedCrooked I beg to differ. Shit is exactly what you get done with C.
2
user1182183
I'm making a debugger because after many years I can't believe no one made yet one for SA-MP (scripts)
So MCSV is the one that's "right", or more accurate?
Xeo
Xeo
5
Q: Clang and Intel fail to compile this CRTP code

VincentI have written a small library that use a lot of C++11 metaprogramming techniques and CRTP, and it compiles well with g++ 4.7.2 Now, I try to compile it with Intel icpc 13.0.0.079 and it generates several hundreds of errors. So I try to isolate the problems one after another. So, first, conside...

Injected class names strike again.
@GigaBass What is "MCSV"? That's one I haven't heard of before. Is it related to MSVC?
14:43
shit not again
MSCV*
Xeo
Xeo
Still wrong.
@Xeo you mean, broken 2phase lookup?
MCVS*
Xeo
Xeo
@sehe Huh?
We're not talking MSVC here.
Jesus christ LOL I'll never get it right
14:43
@Xeo "Injected class names"?
@GigaBass I am opening bets on what you will try next.
@sehe Yes, that's a thing.
@Xeo I understand. However, it might be that he's complaining that Intel / Clang refuse code accepted by MSVC?
Xeo
Xeo
The identifier Derived names, inside its own class, the complete type Derived<Whatever>. This is called an injected class name. I think this is a bug with GCC. — Xeo 2 mins ago
@sehe Accepted by GCC.
@R.MartinhoFernandes 20 Euro, MCVS again.
14:44
@Xeo Didn't know it was called that
MSVS MicroSoft VisualStudio, won't get it wrong again :<
@GigaBass MS stands for Microsoft. Once you got that anchored then the VC should come naturally.
@Xeo Ok, I hadn't clicked the link. Was just responding to that jargon you posted
Yeah thought about that just now x)
when in doubt...call it VC++
Xeo
Xeo
14:45
@GigaBass That's the IDE. I thought you were talking about the compiler?
@melak47 Or just VC
I was talking about MicroSoft Visual Studio's performance analysis
@GigaBass why didn't you say so :p
I'll go bury myself a grave, brb...
2
Xeo
Xeo
@GigaBass Btw, it's Microsoft, no capital s.
14:46
dig*
Xeo
Xeo
And please read the newbie hints.
They tell you useful things like how to edit your messages.
Was first thing I did first time I ever came here, just not used to it(edit, see what I did there? :D), never used any Client that allowed previous message editting
You were the one that actively asked where the rules were, right?
Yes, I was, had a generic User262626324234 name before
So, yeah, @Xeo, cut him some slack.
He is awesome.
user1182183
14:48
hm can you format integers in cout?
Xeo
Xeo
@GamErix Don't even try.
Just use printf.
Don't try to do formatting with iostreams
@R.MartinhoFernandes LOOOL
user1182183
@Xeo owkay
user1182183
like %02d ;x
14:48
But don't listen to Xeo
Never use printf for anything
2
Xeo
Xeo
Pah
Also, @Xeo "the <: is not interpreted as a digraph in a template argument list. – Xeo 3" is not accurate.
Use Boost.Format or FastFormat or something
@CatPlusPlus String::Format. :3c
Xeo
Xeo
@R.MartinhoFernandes Meh, I don't have the standard open right now and I just wanted to get the message across.
user1182183
14:49
@CatPlusPlus why not use printf to just output something? ;o
@Xeo std::unique_ptr<char<::>> :P
@ThePhD I dont' get your emoticons
printf is not type-safe
type safety
Xeo
Xeo
@R.MartinhoFernandes Meh.
14:50
also, I'm a cat, your argument is invalid.
It's an exception with exceptions in it. Typical C++
Xeo
Xeo
Yeah
It tries both or something.
Whatever.
@TonyTheLion redundant use of "so" detected
I've ordered sushi, I have no idea what those names mean
This will be interesting
Xeo
Xeo
Tell me
14:50
It's <:: not followed by > or :.
@sehe fixed
Xeo
Xeo
@R.MartinhoFernandes :::?!
@CatPlusPlus How many names are there?
@TonyTheLion much better
Xeo
Xeo
14:51
Ew.
@sehe It's a Catface, upon which said catface is smugly resting its hand on its hand/paw/thing.
Xeo
Xeo
Right.
The more names there are, the more likely it is you end the day with a slight food poisoning
More than 0 which makes it effort to google
To be honest, I'm not sure where I picked it up.
14:51
If there are four, it's "food", "food", "food", and "food".
Hm.
ptr2ptr_uniqueptr si definitely useful. @__@
I can't do &auniqueptr.get() and have it behave nicely.
@CatPlusPlus ಠ_ಠ
Gotta .reset all the time.
14:53
Ordering sushi would be rather expensive.
morning
@ThePhD Oh, I know what that is. Which means that name is terrible.
And no, I don't know a good name.
:P
;~;
Why u giev me hopes? :c
Xeo
Xeo
I'd so like for integral promotions to not exist right now...
I think "ThePhD" sounds the name of a band, kinda like MGMT.
Xeo
Xeo
14:56
I could just hit compile and fix all the places where uint32_t is still used. :(
"Never use printf for anything", what, why? Have only ever used printf for everything
Xeo
Xeo
And UCSs make sure I can't simply write a UDT to disallow double-conversion, since you get two standard conversions for free with the package...
GCC will actually report type-errors for printf.
Hmmm, reinterpret_cast<T&>(some_int) is not the same as *reinterpret_cast<T*>(some_int).
Xeo
Xeo
@R.MartinhoFernandes Well, d'uh.
You're missing a & in the second code.
14:58
No.
some_int is the address.
Xeo
Xeo
Ah. Well, yeah.
Remember, reinterpret_cast<T&>(var) is specified as *reinterpret_cast<T*>(&var)
That's why I thought you missed a &.
@TonyTheLion What
I'm lazy
And bit hungry
@R.MartinhoFernandes lol

« first day (815 days earlier)      last day (4359 days later) »