« first day (329 days earlier)      last day (4634 days later) » 

5:00 PM
FWIW I have some code that does return a T&&. Things like auto&& blah = dangerous(foo); will break but that's caller beware.
 
@LucDanton Won't the first case make a copy sometimes?
 
Or is there a default base class like java does?
 
Als
@LewsTherin: I think this explains better
8
A: C++ Constructor

Alsmyclass (unsigned int param) : param_ (param) This construct is called a Member Initializer List in C++. It initializes your member param_ to a value param. What is the difference between Initializing And Assignment inside constructor? & What is the advantage? There is a difference b...

Being my answer :P
 
@RMartinhoFernandes If you pass an rvalue and the type can't be moved, yes. If you pass an rvalue it can be a move, too. If you pass an lvalue then no, it goes through unchanged.
 
lol will read it thanks :)
 
5:01 PM
You have to make the choice.
 
Als
@TonyTheTiger: You could post my answer for the advantage thingy I think it explains better :P
 
Hmm. T& && becomes T&?
 
Either auto&& blah = safe(rvalue); does a move/copy, or auto&& blah = dangerous(rvalue); ends up dangling.
 
auto &&x =* new int; becomes an int&
 
5:02 PM
I named my trait that does is_same with decaying is_related. It helps cutting down on verticality.
 
@Als
When you initialize fields via initializer list the constructors will be called once.

If you use the assignment then the fields will be first initialized with default constructors and then reassigned (via assignment operator) with actual values.

As you see there is an additional overhead of creation & as
The constructor is always called once
whther I use assignment or not
WHy will it be reassigned, unless you do it yourself? I am confused
 
Fun fact: if you use a template<typename T> T&& operator=(T&&); then GCC might actually fumble on the return type and returns an rvalue ref when you pass in an lvalue.
 
Als
@LewsTherin: That talks of calling constructor of the member type in the class.
 
Thanks all. I knew I was doing something not so well.
 
Doesn't happen if you use a regular member.
@RMartinhoFernandes My turn to ask for your opinion then :)
 
5:06 PM
@Als you mean a member object?
 
Als
Yes
 
@LucDanton Ask away :)
 
Ok , I see..after it has initialized the values in the member object, then it starts to initialize its own fields
 
Right. So I installed a more recent GCC snapshot and it either unbroke some of my stuff or I used some workaround and now I have the unit tests for my named parameter code working again.
 
and that is where the overhead is...it could have done it in one go..?
 
5:07 PM
found milk-drinking video on u2b, but it's age 16 restricted!
 
I decided to provide a macro to help define 'named' overload of a function.
 
Als
@LewsTherin: Did you read the answer i posted as link?
That explains quite clearly?
 
Couldn't do it without Boost.PP though and I'm not quite sure it looks that nice.
 
"I wish I was the cow" - pensfanforlife8 on YouTube 1 week ago
 
yeah I'm reading it
what is POD?
 
5:09 PM
lol @AlfPSteinbach
 
Age restricted?
WTF? Children can't see a gal milking a cow?
 
@RMartinhoFernandes have to sign in
70
Q: What are POD types in C++?

ceretullisI've been following SO for a bit now, and I've come across this term POD-type a few times... what does it mean?

 
@Als what is POD?
 
Als
uhm? Are you reading just my messages?
 
ah thanks
 
Als
5:11 PM
@AlfPSteinbach: Already posted it like superfast.
Darn Alf you and your new laptop are fast.
 
@Als he he thanks, but i think i'm slooooooow laptop is OK
 
so basically I can initialize the PODs with the member initializers list and also assign them using = operators in the body of the constructor
with no overhead
 
@LucDanton I don't see how you could make a nicer interface with current language features.
 
@RMartinhoFernandes Previous attempt used variadic macros so it looked like DEFINE_NAMED_OVERLOAD( function, name0, name1, name2 );
 
Hmm, yeah commas looks a tad neater.
 
5:15 PM
oh shit..i just discovered a problem...if i was to pass in an object like so as a reference *( new Object())
 
But why didn't it work?
 
I wont be able to delete it
 
I dropped the idea because the only thing you can do with a variadic macro pack is to textually expand it. So I had to do some tuple manipulation to move the names around. Too much dependency between preprocessing and actual code.
 
unless I keep track using a temp pointer
grr
 
@LucDanton Oh, that sucks.
 
Als
5:16 PM
@LewsTherin: Hmm
 
@LewsTherin Object& x = * new Object(); delete &x; works.
 
i.e. the named overload forwarded to another overload with function(detail::hide_overload(), std::forward_as_tuple(__VA__ARGS__), params...);
 
I didn't knew variadic macros were that limited.
 
(so it actually cost two overloads, one of which I 'hid' with that hide_overload type.)
 
Really, that makes sense you can free a reference
thanks man
 
5:18 PM
Now I need delegating constructors to provide a similar macro for constructors!
 
FWIW, I downvoted the topvoted answer here stackoverflow.com/questions/146452/what-are-pod-types-in-c/…
51
A: What are POD types in C++?

Greg HewgillPOD stands for Plain Old Data - that is, a struct (or class) with no members except data members. Wikipedia goes into a bit more detail and defines a POD in C++ as "A Plain Old Data Structure in C++ is an aggregate class that contains only PODS as members, has no user-defined destructor, no user-...

 
Als
@LewsTherin: I am lost...I don;t know who you are talking to :)
@JohannesSchaublitb: At your intelligent tricks again......
 
@Als no it's not a joke. if you look at the down/up votes for it, it has some downvotes. one came from me
 
Als
Darn with you around, I am always afraid You would say something and then I would feel I don't know shit.
 
SO needs a special marker to indicate "Downvoted by @Johannes".
 
5:19 PM
@RMartinhoFernandes there is no need.
i'm telling you to inform you of my downvote. that does not mean you need to be informed by all my downvotes
 
@LucDanton What new C++11 features will GCC 4.7 have?
Other than std::underlying_type, which I learned about a while back.
 
because I saw someone above linked to that answer/question, I felt the need to share my downvote with you.
 
Mmmh, I've switched for quite some now, I don't really remember. (I'm checking on the site though.)
 
and I upvoted @Steve's answer in that same question
 
Looks like override is in. Let's test it.
 
5:21 PM
@JohannesSchaublitb even better if explain reason for downvote, both at q and here... ?
I think the answer is sloppy, but i wouldn't downvote?
 
@Als xD I'm a mad man Lews Therin Telamon :P
 
@AlfPSteinbach the reason is in the question's answer list itself. the topvoted answer directly contradicts with the downvoted answer
 
And final as well.
 
and has no downvotes
 
@JohannesSchaublitb that's a bit cryptic. i hope you aren't expecting us to read and think and so on-. what mean?
oh "no members"
id din't c thath
 
5:23 PM
@AlfPSteinbach i avoid to tell the answerer that I downvoted him
 
@RMartinhoFernandes When it comes to library improvements, I think - many small improvements to conform to the FDIS. sums it quite well.
 
I only do so if there is no chance for him/her to know what is wrong
in this case, it'S trivial for him to know what he did wrong in his answer
 
@Als I feel like that all the time on SO and in this room :(
 
@Luc I want template aliases!
 
@JohannesSchaublitb i think that may help for rep (no revenge downvoting on you), but the way I think of it is that an explanation would help others, and don't care about rep.
 
5:25 PM
@AlfPSteinbach ah wait I seem to remember I did have IRC contact with him at that time!
 
Hey guys, quick question: When I sent a function an address to a 2d array how do I manipulate the contents of the array?
 
@TrevorArjeski it would be linear i believe
so treat it like a 1d array
 
Als
@TonyTheTiger: Sailing in same boats :)
 
did i post this yesterday? not sure. it really got rhythm
 
5:27 PM
@Als you are right might compiler complains when I try to init in the body of the constructor....I can't see it. the only reason I see was if you had a base class that initialized the reference
if it doesn't then the class itself can reference the variable in the constructor body..almost the same thing
 
Als
@LewsTherin: Okay
 
as the init list
Ok?
 
@AlfPSteinbach hmm it seems it was about a different thing - no log entries
but anyway, I think the guy knows why he was downvoted.
 
So if I use functions like glDrawPixels it expects a pointer to a memory location holding all the pixel values. Is it a good idea to use std::vector as a wrapper around this memory?
If so how to do it, so far I was just able to produce crashes ;)
 
5:30 PM
virtual
const char*
what() const noexcept override;
 
@Nils vector.data() gives you the stuff?
 
How noisy.
 
Als
@LewsTherin: Don't understand what you mean to say
 
@Als
Imagine I have a class Dog, and takes a reference to the dog's name. The dog has no base constructor so I can initialize either using the member initializer list or use the body of the constructor
 
so for the first time in months I'm going to socialize with real life people tonight :) Woo
 
5:32 PM
It should be equivalent
@TonyTheTiger that'll be awkward..unless you know the norm
 
vector has a data() member? @RMartinhoFernandes I thought I'll have to use something like &(myVec[0])?
 
Dec 22 '10 at 10:19, by Johannes Schaub - litb
@sbi the first FAQ entry is a bad one. the answer given there is factually wrong
 
@Nils That works too.
 
Als
@LewsTherin: Dog has no Base class constructor?
 
5:34 PM
@LewsTherin stick to initializer lists, that's the most common way to init values in the ctor
 
Nope just a class, and takes a reference to a string in its constructor
@TonyTheTiger I know man, but someone like me needs to know the why
 
@AlfPSteinbach ah no
Dec 22 '10 at 11:00, by Johannes Schaub - litb
@sbi greg is online in IRC. i've just sent him a message
 
dog(const std::string& name) : name_(name) {}
 
@Nils main difference is that data() is const.
 
Looks I only used polymorphism for my exception types and one instance of type erasure.
 
5:36 PM
is data() standard?
cplusplus.com/reference/stl/vector/vector why is it not listed here?
 
It is at least in C++11. §23.3.6.4
 
@RMartinhoFernandes It's overloaded, just like operator[].
 
@LucDanton Oh, right. Stupid me.
v.data() works for empty vectors, while &v[0] doesn't, am I right?
 
ah well I don't have C++11 here yet
or well just clang
 
@RMartinhoFernandes Looks like it.
 
5:39 PM
I just realized something
I declared an array of pointers to some objects
 
"Unfortunately, this video is not available in Germany because it may contain music for which GEMA has not granted the respective music rights."
-,-
 
Ah nevermind...something is screwed up though
 
@LewsTherin this explains why you should use init lists instead of assignment in the ctor
it's all about efficiency :)
 
Als
@TonyTheTiger: I already posted an answer of mine, which does that here
 
5:41 PM
fucking glut
 
@TonyTheTiger Well... it's primarily about being able to initialize data members instead of assigning to them.
 
crashes and I don't know why
 
Of course you have to understand the difference between initialization and assignment in general to see why this is important for data members in particular.
@Nils Have you checked the error codes? :)
 
bus error?
 
Als
42 mins ago, by Als
8
A: C++ Constructor

Alsmyclass (unsigned int param) : param_ (param) This construct is called a Member Initializer List in C++. It initializes your member param_ to a value param. What is the difference between Initializing And Assignment inside constructor? & What is the advantage? There is a difference b...

 
5:42 PM
but the pointer to the pixel data seems to be fine and data allocated
 
@FredOverflow exactly...I see it as the same lol
initialize in my eyes means assign something to a variable
 
Well, I don't know glut, but it has a C API, right? So every function call should either return an error code or set a global error variable. Have you checked them everywhere? If you don't check, 10 lines later you may get a weird crash.
 
But I guess it is wrong
 
Als
@LewsTherin: ideone.com/L47OZ
 
@LewsTherin initialize is to set the startup value of the variable, cause a variable can be assigned another value after
 
5:43 PM
@JohannesSchaublitb That I could watch. :)
 
because initialize means creating an instance of a object then assign a teh same time
 
Als
You wanted to do that
 
if you don't init an int to 0 for example, explicitly, then you'll invoke UB if you try to read from it
 
@Als yeah, but it constructor the string should be a reference
 
Als
@TonyTheTiger: Not always
 
5:44 PM
@TonyTheTiger what is UB?
 
@LewsTherin For user-defined types, initialization means "invoking a constructor" to put an object into existence, whereas assignment means "calling the assignment operator" to change an already existing object.
 
@robert well it's not quite the same w/o the video, but this is the radio edit: grooveshark.com/#/s/Candyman+radio+Edit+/3QxLZa?src=5
 
@LewsTherin Undefined Behaviour
 
Nasty things.
 
@Als in what cases can you read from an uninitialized int?
 
5:45 PM
Ah yes, or SF
 
Like Yog-Sothoth coming to your house and eating your children alive.
 
humm @FredOverflow well I haven't looked up the error codes or weather they have
 
only if the int is unsigned char and the int's address was previously taken
 
Als
@TonyTheTiger: If it is static or global....rings bells?
 
5:46 PM
effectively
 
When I was 10.. rubber meant eraser,ass meant donkey,gay meant happy,straight meant linear,making out meant 'logical detection',Cock meant rooster,pussy meant cat, stag meant a male deer, prick meant a jab, poke meant a nudge, chick meant a baby hen, screw meant a carpenter's implement anda Tit was always for Tat!! Damnmm !!!! English has changed so much !!!!! :p (found on net)
 
@Als oh, you pedant :P
@JohannesSchaublitb are you talking to me?
 
nah they are all of type void
 
@Als it should be dog(std::string &name)
 
5:47 PM
im unsure im talking to general
 
Als
When I was 10.. rubber meant eraser...No rubber always meant a condom to me :P
 
@AlfPSteinbach Thanks. Groovy. :)
 
glutInit for example
 
Als
@LewsTherin: You come up with the code sample then.
I think we have given you considerable examples, none coming from your side.
if you have to learn you have to work for it not get the work done
 
when I was young I could go to titsandasses.org without being embarassed.
 
5:48 PM
also get a good C++ book
 
@Mahesh When I was 10, C++ only had one kind of reference and two kinds of value categories (lvalues and rvalues). Damn, C++ has changed so much!
 
@LewsTherin you can't learn C++ from this chat, you need to get and read a good C++ book
 
Als
@JohannesSchaublitb: Why are you embarassed now? As i see you have atleast one of those. :P
 
@JohannesSchaublitb too much information
 
@Nils again, global error code variables probably exist that you can query with get_last_error or something.
 
5:49 PM
lol
 
@Als - Cover usually refers to Condom. And mistakenly I asked for it at Walmart. They call it a bag to hold things :)
 
Als
@JohannesSchaublitb: Or maybe both :P
haha
 
@Als i would know if you "saw" anything
 
@Mahesh So what are those cover stories that newspapers have then?
 
Als
5:50 PM
@Mahesh: You seem to be a Uncle Sam fan.
 
What about government cover-ups?
 
Als
We are not..atleast me :)
 
@FredOverflow - I amn't sure. Americans way of speaking.
 
@FredOverflow ah will have to check that
 
5:51 PM
@TonyTheTiger yeah I am just here in case someone who knows trig shows up :P
Unless you can help with that? :P
 
Just say struct Dog { std::string &name; };
 
They have a game called "Football" where most of the time the ball will be in hand :)
 
@LewsTherin I know that sin^2 + cos^2 = 1, does that help?
 
Als
Thats American Football, Once you say all bets are off like an UB.
 
@JohannesSchaublitb Why the reference?
 
5:52 PM
I know that e^(i*pi) + 1 = 0!
 
@FredOverflow ha ha its a bit more complex than that :(
 
@FredOverflow you would need to ask @Lews
 
@FredOverflow I like it more with 0 and 1.
0 and 1 are more fundamental than -1.
 
@Als - Uncle Sam ?
 
5:53 PM
@RMartinhoFernandes Oh, I didn't notice :)
 
@Als did you get the link?
 
Als
@Mahesh: I do not know, why you would say things like Usually....... Why do you assume we prefer or glorify american way of living?
 
thanks god im european
 
Als
@LewsTherin: It does not even compile, what you want me to see in that?
 
5:55 PM
@Als, I know it doesn't..which is why I am asking why it demands initializing a reference variable using a member initializers list instead of the body...and i doubt it is because of efficiency
 
Als
Once you say American, all bets are off like an UB, They could be utterly stupid or rather alarmingly intelligent, or rather anything in between.
 
@LewsTherin Because it is impossible to initialize data members inside the constructor body.
When you say ref = foo; that's assignment, not initialization. It assigns to the object reffered to by the reference. It does not assign to the reference itself.
 
@FredOverflow, say what? Sure you can...
 
@Als - Ok
 
struct A { int x; A() { A(10); } A(int i):x(i) { } }; works
 
Als
5:56 PM
@LewsTherin: doing what you do, Assigns
 
... but it means something different ...
 
You can only initialize data members inside the ctor-initializer.
 
Als
does not Initializes
 
Oh yeah I think I get it
sorry...
 
5:57 PM
or you can remove all ctors and then you can use an aggregate initializer
 
@LewsTherin When you say a = b, that's always assignment and never initialization in C++.
 
Wait, so saying this
 
You may think that "initialize" means "assign for the first time", but that's not how it works in C++.
 
Als
@LewsTherin: You need a good book to learn C++, It can't be learned in a chat, not especially this one.
 
however you CAN do vector<int> v; v = { 1, 2, 3 }; then it is both assignment and initialization
however to different objects
 
5:58 PM
@FredOverflow, I need to talk to people to understand C++ im a weird human being
 
Data members can only be initialized inside the ctor-initializer, period.
 
Als
@JohannesSchaublitb: You might just scare him, You scare us already
 
@Als im sorry Im trying to clear things up
 
SO basically this means that
Dog(string &n):name(n)
Is equivalent to saying
string &name = n ?
 
Als
5:59 PM
@JohannesSchaublitb: Yeah, Its rather our problem really, we can't match up to you. I would rather not let any new learner converse with you :P
 

« first day (329 days earlier)      last day (4634 days later) »