« first day (856 days earlier)      last day (4075 days later) » 

user142019
2:00 PM
RAII and GC aren't mutually exclusive right?
 
Yes. No. Maybe.
 
user484068
@Zoidberg Hmmm
 
user142019
As in
 
Maybe. Yes. No.
 
user484068
Depends on your definition of GC
 
user142019
2:00 PM
It's possible to have RAII objects that are GC'd if not already destroyed by out of scope/exception.
 
user484068
Herb Sutter is including ref counting smart pointer in that definition now
 
well, when the GC destroys an object, then the destructor would be invoked and clean up any resources
so I think they would go hand in hand
 
In most mainstream GCs you should assume that the GC never destroy objects.
 
what does it do then?
mark them for destruction, but who invokes the dtor then?
 
user142019
delete is nop. :P
 
2:02 PM
@TonyTheLion Mark what for destruction?
 
objects that are no longer needed
 
Why are you assuming the GC will ever clean up anything?
 
@TonyTheLion Wat, I'm always happy to see you.
 
because it's called garbage collector
@DeadMG :) Awww
 
Guys, I just wanted to ask, what is the best resource for learning about data structures in C++? I tried looking for video lectures, but I could not find anything other than a guy on YouTube. Anywhere good that you guys learnt it from?
 
2:03 PM
@TonyTheLion and you're called Tony The Lion
 
@TonyTheLion So what? It doesn't have to run if you have enough memory.
I see no reason to disallow stuff like this:
auto x = reinterpret_cast<float>(42);
Currently one has to write stuff like this:
auto const x = rvalue;
auto y = *reinterpret_cast<float const*>(x);
WTF
 
Just asking to see if I missed something
 
Why do I keep following that mailing list.
 
@LightnessRacesinOrbit thanks for stating the blimming obvious
 
2130
Q: The Definitive C++ Book Guide and List

grepsedawkThis question attempts to collect the few pearls among the dozens of bad C++ books that are released every year. Unlike many other programming languages, which are often picked up on the go from tutorials found on the Internet, few are able to quickly pick up C++ without studying a good C++ book...

 
2:04 PM
@GamesBrainiac YouTube? Pffsh. I learnt everything from a crazy guy in a cave.
 
@TonyTheLion and to you, as well.
 
@R.MartinhoFernandes meh
you silly fool, I was talking in the cases where it does run
stop being pedantic
@Zoidberg also, huh?
 
user142019
3 mins ago, by R. Martinho Fernandes
In most mainstream GCs you should assume that the GC never destroy objects.
 
delete can't be a nop
 
user142019
(I was joking.)
 
2:05 PM
that makes no sense
 
user142019
@TonyTheLion oh no?
 
user142019
operator delete(void*) /* or whatever the signature was */ { }
 
@Zoidberg eh, I suck at text humor
 
@TonyTheLion The point is that there is no guarantee it will, and when it does, there is no guarantee it will clean up some particular object. You cannot rely on it to clean up resources.
You should just assume it never runs and write your code accordingly.
 
@R.MartinhoFernandes so WTF is the point of having one at all then?
like in .NET based languages
 
user142019
2:06 PM
In the ideal world the only resource would be memory and GC would work for everything.
 
@TonyTheLion You don't run out of memory (unless you do; but let's not go there). Memory is all it can handle.
 
eh
you guys are too abstract
 
@TonyTheLion I am not being abstract. This is how it works.
 
I don't get it :( You're saying it doesn't clean up anything, even when it runs, but it handles memory. What the heck does it do with things that need to be "garbage collected" then?
 
user484068
@TonyTheLion - RAII is used for more than just memory as @R.MartinhoFernandes mentioned
 
2:08 PM
@TonyTheLion Yes, the .NET GC does not guarantee cleanup of anything.
@TonyTheLion Nothing you can rely on.
 
@TonyTheLion Reclaims the memory they used.
(Maybe)
 
The only thing you can rely on is having the illusion of vast amounts of free memory.
 
meh
software with it's non guarantees
 
In order to created a sorted list of a seft created class, do you just need to overload the > operator, or do you need to overload all operators/
create*
 
@GamesBrainiac It's operator<, actually.
 
user484068
2:10 PM
@TonyTheLion - Generally one of the advantages of C++ is deterministic destruction. Garbage collection is usually non-deterministic. On that basis they are usually incompatible. Herb Sutter is trying to convince people that smart pointers are just another form of garbage collection, which of course do fit the C++ deterministic model.
 
the < operator?
Why not the other?
 
Because.
Yeah, that's it.
 
So, if I simply overload that, < and > will both work?
 
No. sort will work.
 
Thats all i need
So, I can sort just by overloading the < operator?
as in use std::sort
on a vector?
 
2:12 PM
Yep.
 
look at this pearl ^
 
That's old.
 
@BenHanson yes, but Robot has just been saying that GC doesn't destroy anything. So that contradicts
 
12 mins ago, by R. Martinho Fernandes
In most mainstream GCs you should assume that the GC never destroy objects.
 
exactly, so what the heck?
 
2:14 PM
Okay, so how would you go about overloading something like this:
 
It's a simulation of infinite memory.
 
one says it's non deterministic destruction and the other says it never destroys objects
 
You have a class, which has name as a string, and that string is the main thing you are going to use in order to compare. In short you want to order them by name in a sorted list
 
that doesn't hang together very well
 
@TonyTheLion It only destroys objects if it has to.
 
user484068
2:15 PM
@TonyTheLion - Yes, classic garbage collection simply reclaims memory. If it was changed to call C++ destructors too, then as there is no determinism, all hell could break loose.
 
@GamesBrainiac so you define an operator that compares that names, yes
 
@GamesBrainiac yes, how do you want them ordered? ie lexographically or some other way, you have to tell it.
 
@TonyTheLion Non-deterministic means you cannot know when or whether it will happen.
 
so you would create the function bool operator < (Type & a, Type & b)
 
it is non-deterministic destruction in that if destruction is necessary, it will destroy them.
 
2:15 PM
@GamesBrainiac Sort using a custom comparator. Probably a lambda.
 
@GamesBrainiac const is missing.
 
That's why you should assume it won't and program accordingly (i.e. clean up manually or through other means).
 
its lexographic by default in a string msdn.microsoft.com/en-us/library/b8s4yft5(v=vs.80).aspx
so, if i just compare string of the first name
will that not be enough?
 
should be.
 
2:16 PM
@DeadMG : okay, will add const for const safe
 
as long as you don't ever want more than one item of the same name in the list.
 
no, i got input protection for that
 
@GamesBrainiac that sounds odd
 
there can be no two items
of the same name
the program will simply ignore that piece of input
 
@BartekBanachewicz : but, may I just ask, why is that odd?
 
@GamesBrainiac I am not sure what you mean by input protection
 
I just mean, that if someone enters the same name twice, that input will simply be disregarded
Its an ultra primitive program
For learning purposes
Not the cool stuff you guys are probably building
 
I am building something remarkably cool.
 
@DeadMG : What might that be?
 
2:22 PM
but decided to pause because, well, I need money to eat
 
> I got older, wiser, and more opinionated. I still like the concept of helpers – of methods. However, the way helpers are implemented in Rails sucks. Also, having object-disoriented functions in your view brings us back to the years where OOP still had to be invented.
People who think OOP is about ~methods~ are hilarious
 
@GamesBrainiac Language.
 
@DeadMG : C++ compiler?
 
@GamesBrainiac lolno.
a language I designed
 
2:24 PM
I'm so proud of that favicon
 
What favicon?
 
@AndreiTita : Thank you so much. Its more than I would ever have wanted, but is that a lambda you used?
 
On Coliru
 
@GamesBrainiac Yeah, but there are multiple ways to implement this.
 
Oh, you made that?
 
2:25 PM
It's actually terrible that favicon
 
@AndreiTita : I just want to thank you man.
I humbly appreciate it
I hope I can help you when I get better at this
Some day! :D
 
user142019
Is there any use-case for a non-virtual dtor in a class with virtual functions?
 
Same with dead
 
@Zoidberg Trolling?
 
user142019
2:26 PM
Uh no?
 
I meant "trolling the future users of that code".
 
user142019
No I'm not writing any code. Just wondering.
 
user142019
Stop assuming things.
 
Argh.
 
@R.MartinhoFernandes It's awesome you just can't appreciate art
 
2:27 PM
That was the answer, you dolt.
 
@Zoidberg If you're using something like shared_ptr, which already has a type-erased deleter.
and then you're WTF desperate for performance.
 
@AndreiTita : Could you explain the empty closed square brackets
 
Actually, I need a logo for ogonek that isn't as boring as an actual ogonek stolen from Arial or whatever.
 
@GamesBrainiac Lambda syntax.
 
@AndreiTita : msdn.microsoft.com/en-us/library/vstudio/dd293608.aspx seems to have a name in it
 
@DeadMG : Why emphasies on "expressions"
Why can't you just call it a function
 
user142019
@DeadMG Oh okay. xD
 
user142019
Well it's the standard library.
 
@GamesBrainiac Because a function definition is not an expression.
 
2:30 PM
Good morning
 
@Cicada morning!
 
@DeadMG : I see. But isn't writing a function essentially what you are doing, an inline function. Pardon me for being thick.
 
meh, doctor won't give me painkillers with codeine because I'm too young
but nothing else kills the pain
how silly
 
user142019
Grammar is almost done. Only interface bodies, expressions and maybe a few more statements to be done. gist.io/4973923
 
@TonyTheLion Does that make your write more codes
 
2:31 PM
@GamesBrainiac Yes, but regular function definitions are different.
 
@Cicada I wish
 
the point is that a C++ function definition is a statement, and a lambda definition is an expression.
 
@DeadMG : All I can see is that this lambda is simply a self invoking anonymous function similar to that in JS
 
@DeadMG : To me, its the same as writing a function and making it inline
 
2:32 PM
@GamesBrainiac The square brackets are the capture list, it has the variables you want to have available in the lamba from the enclosing scope. If you leave it empty, nothing's captured
 
@GamesBrainiac Those things also are expressions.
 
@GamesBrainiac It is most definitely not the same.
inline functions cannot capture local variables- lambdas can.
 
@Collin : You are friggin awesome! :D Thanks
 
@GamesBrainiac But in fact it's a callable object, a functor.
 
@BartekBanachewicz Ahahaha there's a misplaced cube under the C! 0/10
 
2:33 PM
@Cicada 0? :(
 
j/k it's nice
 
it works :)
 
@DeadMG : So essentially, it has the benefits of a function that can execute tasks locally, but give results globally
Making it not mess your code up
 
I am now reading about Perlin noises to generate the terrain
 
@GamesBrainiac More like, it can use your local information in it's computations.
 
@DeadMG : I can see why this would be useful
 
@BartekBanachewicz Also read the simplex!
 
Especially in something like sort
 
yep
 
@Cicada simplex's greatest advantage shows on multidimensional generations. I need only 2D texture
 
2:35 PM
function objects are a really common customization point for algorithms
 
@BartekBanachewicz For culture
 
and lambdas are an important way of using that point.
 
really, cygwin gcc is still 4.5?
 
so it's important to know lambdas
 
@Cicada to be honest, this stuff is kind of boring for me. I just want the random terrain.
 
2:35 PM
@DeadMG : I wish you were my teacher, instead of the idiot i have now
He ddnt even teach us vectors
 
@BartekBanachewicz Oh okay. I thought it was interesting.
 
And vectors are friggin amazing
2
 
INORITE
 
@Cicada I can read about it just for you, lol
 
2:36 PM
@GamesBrainiac You'll discover there are a TON of bad C++ teachers, and it's because they had bad teachers, it's the circle of horribleness
 
@GamesBrainiac Indeed- they are one of the basic building blocks.
 
@DeadMG : Thats because C++ is not simple
Its incredibly powerful
but not simple
 
inb4 "wow we're all learning so much thanks"
 
u mad
 
2:37 PM
strangely, I found it quite simple.
 
@LucDanton yeah i got mad :D
 
you just need to know, what it is that you're doing.
 
@DeadMG : But let me as again, since you're here, and you are quite good at explaining things, can you not just put in an inline function in there?
 
@GamesBrainiac Learn from the best
 
user142019
Hmm.
 
2:38 PM
@Collin : Thanks my man. I try to, but good teachers are hard to find
 
@GamesBrainiac If you defined it somewhere else (can't put it directly in there because it's not an expression) then yes, you can.
 
user142019
Shall I make interface implementation implicit.
 
just as long as it's not overloaded, or templated, in which case that's not so much fun.
 
user142019
Your class simply conforms to an interface if it implements all functions.
 
... and you don't want whoever's reading your code to know what it does.
 
user142019
2:38 PM
Not required to state it explcitly.
 
@DeadMG : I think I understand why you emphasised on the expression bit
Its quite useful
 
@Zoidberg wasn't that called duck typing?
 
yes
 
user142019
No.
 
the most important property
 
2:39 PM
@Zoidberg it is useful
 
@Cicada Unfortunately there is no known cure for mansplaining, so it's always hard to stop someone on a bender.
 
user142019
Duck typing means that if it behaves as a duck, it is a duck. But "duck" doesn't need to be defined anywhere.
 
because the logic is written directly where it is used, so you can see what the fuck is going on.
 
@Zoidberg semantics
 
user142019
I'm aiming for something more like this:
 
2:39 PM
whereas if you refer to some function defined somewhere else
 
Anyone know a good C++ video lecture series that has data structures in it?
 
then it could do any fucking thing
 
@GamesBrainiac why video?
 
I like following along on my PC
with the instructor
 
you can just, y'know, read
 
2:40 PM
 
@LucDanton I know I know. Allow me though to say "fuck you" though, if you don't mind.
 
@BartekBanachewicz : Cuz, I prefer the laziest approach
 
@Cicada ... though.
 
@GamesBrainiac at one point you will have to start reading anyway. Why not start properly?
 
2:41 PM
@BartekBanachewicz : I am slowly realising that
:P
 
user142019
public interface Printable<_> {
    print();
}

public class String /* see? no explicit ": Printable" */ {
    fn Unit print();
}
 
@Zoidberg do you know the keyword override in C++?
 
@CatPlusPlus Should I flip that vertically?
 
user142019
@BartekBanachewicz yes and it is completely irrelevant.
 
@Zoidberg it's completely relevant
 
2:42 PM
@R.MartinhoFernandes I don't know, you think it'll be better? :v
 
user142019
@BartekBanachewicz No.
 
It looks like a cedilla to me.
 
It's an ogonek with two bananas!
4
 
user142019
override gives an error if your function does not override a function of a base class.
 
user142019
2:43 PM
That is completely irrelevant to implicit interfaces.
 
have it your way then
I think that's a bad idea.
 
I'll take it.
 
The interface name isn't there for the compiler
It's there for the human
 
damn you anacron! what use is day granularity?!
 
Oh wait you said logo not favicon I can make it bigger :v
 
2:44 PM
@thecoshman Why don't you use cron? It has minute granularity.
 
@Cicada it's for my desktop
 
@CatPlusPlus I was going to ask that.
 
@thecoshman Well cron exists for desktop too?
 
@Cicada it does, but I want it to attempt to sync every 6pm, and if my pc is not on, do so once it finally does start up.
 
Oh god dammit who writes such a code
// create and return an instance of your application
TheApplication *createApplication()
{
  return new TheGame();
}
 
2:46 PM
anacron is almost good enough for that, but not quite
 
@BartekBanachewicz Everyone.
 
@BartekBanachewicz Does that mean your application can create many instances of your application?
Reminds me of fork().
 
It's sick.
Anyway, somewhere here is terrain generation
At least I think so
 
@CatPlusPlus so much paint
 
@SaladFruitcake Have you ever been on IRC? What acceptable use case is to be found in posting forty messages in ten seconds? — badp 1 hour ago
 
@CatPlusPlus Awesome. wgetting.
@BartekBanachewicz You think you can do better? Bring it on.
 
@R.MartinhoFernandes sure
 
2:49 PM
@CatPlusPlus woah :effort:
 
@Pekka웃 And why not test drive sbi's suggestion? Do you really believe it's gonna turn into some chatpocalypse? — Salad Fruitcake yesterday
 
@FredOverflow you said I should return a reference instead of a pointer - but I only have the pointer to the D3D device (COM thingy). Should I return a reference to the static pointer variable?
 
@the unfortunate victims of corporate stupidity: get an exception for in-house libraries, then import the useful parts of Boost into the in-house library. Even in politics all problems can be solved with another level of indirection. — MSalters Apr 6 '10 at 9:56
^ beautiful in a strange way
 
hey! Nice :)
 
2:56 PM
Pff stealing my idea
 
thanks. :)
@CatPlusPlus oh, I based on it. Sorry.
Your idea was good, just lacked proper materialization.
 
Okay, folks, one question, Obj-C vs C++
 
Ugh, solid background.
 
Which one?
 
@R.MartinhoFernandes I have a .psd :P
 
2:57 PM
Make it transparent!
 
@GamesBrainiac You're asking the C++ room? I will quote my advanced programming professor: "Obj-C is a terrible language I wish was never invented"
 
lol
Collin, you crack me up! :D
 
>.>
 
@Collin : I wanted to ask you one thing though
About your piece of code
 
my code?
 
2:59 PM
you did not enter anything in the square brackets
 
@R.MartinhoFernandes here , but I now wonder if it should be black instead :P
 
so, how does the expression know what to evaluate?
 
@GamesBrainiac Is there a link back to that? I didn't actually write it..
 

« first day (856 days earlier)      last day (4075 days later) »