« first day (877 days earlier)      last day (4070 days later) » 

Xeo
8:00 PM
You invoked an e-type function pointer as a v-type function pointer.
@sehe It just displays that stupid loading icon when I click "run". :|
 
@Xeo yeah it does that. Compilation just takes a long time. It never failed to complete for me, though
 
Xeo
@sehe More than 5 mins?
 
Cppreference is really well organized.
 
@Xeo, so...I should be casting x up to e in the second lambda?
 
@nneonneo x up to e?
 
Xeo
8:03 PM
lol. A buddy of mine is playing Dwarf Fortress and named one of his Dorfs "Swiss Army Dorf", because he does so many things.
 
1
A: Call lambda without binding it to an identifier

nneonneoOf course, in C++, to call any function you have to bind it to an identifier somewhere, simply owing to syntax constraints. But, if you will accept parameters as being sufficiently unnamed, then it is possible to create a version of the y-combinator in C++ which recurses nicely without being "nam...

 
Xeo
@nneonneo Yes
 
ok.
 
Xeo
And you can drop f0
 
oh
Stephano just lost against Grubby
that goes for "Zerg OP in HoTS"
 
8:04 PM
@GamesBrainiac What kind of reformatting do you use to reach that kind of ... miscalculation?
@GamesBrainiac This is my count:
289546  src_top_dir     ansic=288009,cpp=876,sh=451,asm=114,xml=68,python=28
3638    runtime         perl=1138,ansic=769,awk=715,lisp=501,cs=458,sh=51,
                        csh=6
 
@Xeo: no I don't think I can
 
Xeo
Sec
 
@BartekBanachewicz ^
@Xeo Nope
 
Xeo
Also, just use a fucking C++-style cast, those C-style ones are ugly as heck
 
Quick question: How is global state caching implemented without Singletons?
Say I'm building a library and I need to cache results.
 
8:05 PM
@sehe what is it? Sources?
 
Xeo
@Mysticial Through a global variable?
 
@Mysticial Don't enforce via the type that only a single instance can ever be constructed.
 
Ell
heh my friend is being pwned by ea again xD
 
(Same answer, but longer.)
 
@Xeo: ok, done
 
8:06 PM
@Mysticial Through a global accessor function?
 
Let's say I want to use std::max, but I have to deal with some Windows's max in the way.
 
@Xeo That too. I'll have a class, but there's one instance for each "cacheable" property.
 
Oh, wait.
I can always undef it.
 
@EtiennedeMartel std::(max)
 
@LucDanton Oh ic. Never even dared to consider that.
 
Xeo
8:06 PM
#define WIN32_NO_MINMAX or sth
 
Singleton is: global object, only ever one of that type.
 
I thought you could just #define NOMINMAX
 
@Xeo oh wait durr you're right
 
@sehe ow
 
@Xeo Yeah, but I can't.
 
8:07 PM
@LucDanton it will work. Like ^ he says I gathered he can't use the proper defines
 
now it should be beautiful.
 
Hi everyone. Is there some comparsion sheet of VS2010 and VS2010 in terms of support of C++11? I need to use Qt5 binary build but they are only for VS2010, so i kind of limited to it (since i don't have time to tinker with source code and build it myself, tryed already actually). Or maybe someone already distributes pre-built Qt5 binaries for VS2012?
 
Xeo
@nneonneo The second function pointer type only needs to be void (*)(), no need for the parameter.
 
@Ivan0x32 VS2010 == VS2010?
(I think you did a typo)
 
@Ivan0x32 It's simple. They're identical
 
8:08 PM
@Ivan0x32 "Is there some comparsion sheet of VS2010 and VS2010 in terms of support of C++11?" - it would be empty.
 
@sehe I know. I'd rather keep it as a last ditch attempt, it would leave people scratching their heads I would think. Or is it more common than I think?
 
s/VS2012/VS2010
 
Xeo
3 mins ago, by Xeo
Also, just use a fucking C++-style cast, those C-style ones are ugly as heck
 
@Xeo (Xeo)person <3
 
8:08 PM
@Ivan0x32 that changes nothing!!
:P
 
Xeo
@Mysticial vs2010.cpp11 ^ vs2010.cpp11? :)
 
@nneonneo You're wrong.
 
wait, you think the C casts are ugly?
 
@nneonneo And your joke sucks.
 
8:09 PM
@LucDanton Me too. However, I saw Etienne posting the relevant compiler define before anyone even answered, so... chat.stackoverflow.com/messages/8205415/history
 
Xeo
@nneonneo It's a fact. Get them off my lawn. :)
 
@EtiennedeMartel (cries in a corner)
 
@Mysticial now you are forcing me to get to this 10k again :/
 
@sehe Oh yeah, didn't notice.
 
@BartekBanachewicz Because he likes you.
 
8:09 PM
He's trying to improve you.
 
@EtiennedeMartel ooooh blushies
 
To make you
Be a man
 
@Mysticial wuuuuuuuut
 
(You must be swift as a coursing river!)
To be a man
 
@sehe Someone forgot to put NOMINMAX in a stdafx.h a long time ago.
 
8:10 PM
oh april 1
sillyness
 
I wonder if adding it would silently break some code.
 
@ThePhD have you implemented text display (fonts) already?
 
woo
 
afair last time i've used some atomics :( should expect none in vs2010 then... oh well.
 
@EtiennedeMartel It could. However, preprocessing all sources will tell you. :effort:
 
8:11 PM
Thanks!
 
@DeadMG woof FTFY
 
Grubby beat Stephano
 
@sehe All sources?
 
@EtiennedeMartel If that's all, by all means, #undef min etc.
 
8:11 PM
@BartekBanachewicz Nope.
 
There's hundreds of files in there.
 
@EtiennedeMartel Well, the latest revision. Not all revisions
 
Xeo
@EtiennedeMartel I don't see how it could, really.
 
@ThePhD uh. Okay, I am going at the uknown territory first then, I guess
 
@nneonneo It's beautiful isn't it?
 
but let's play some guitar first!
 
Xeo
@nneonneo The second function pointer type only needs to be void (*)(), no need for the parameter.
 
Lulz...
 
so
 
Xeo
@TonyTheLion 42, for example.
 
8:13 PM
@Xeo standard says non-type can be pointers, so how would that work in this case?
 
@sehe ah beat me to it
 
Xeo
@TonyTheLion The target of the pointer needs to have external linking, IIRC.
 
@TonyTheLion only if address of entities with external linkage
 
Xeo
@sehe No need for the cast.
 
8:14 PM
@Mysticial Elegant in its simplicity. Now I have an idea for IOCCC based on casts with hidden functionality.
 
@Xeo literate coding
 
@sehe ah I see
 
@Xeo I couldn't for the life of me figure what else could be unclear there
 
Xeo
heh
 
f.ex. casts between int and float and *(int *) which can be used for calculation without actual mathematical operations
it would be brilliant
@Xeo ?
 
Xeo
8:15 PM
@nneonneo What's the use of the void* parameter type in f1?
 
> The top-level cv-qualifiers on the template-parameter are ignored when determining its type.
top level?
 
Xeo
int const // top-level
int const& // not top-level
 
@Xeo: so that it's a functional type
 
Hi
 
though I suppose it is never called
 
Xeo
8:16 PM
@nneonneo void (*)()
Is also a function pointer type
 
are all normal function pointers interchangable?
 
Xeo
Yes
 
ffs
 
Xeo
As long as you cast back to the correct type
 
@Xeo directly relating to the type in other words?
 
8:16 PM
ok
 
Xeo
It's like void* for normal pointer types
@TonyTheLion The top-most part of it :P (read: right-most)
 
but not guaranteed to be of the necessary size, so you can't cast a function pointer to void*.
 
Xeo
Exactly
Or, well, I guess it's not like void*, since nothing converts implicitly to that.
Whatever, bottom line is: You can fuck around with pointer types, as long as you cast back to the correct type before usage (or to char*, but that's another matter)
 
@Xeo: thanks for all your help. As you can tell, I don't normally abuse function pointers :P
 
Xeo
Also, I noticed I have a fucking hate against C-style casts by now.
 
8:19 PM
template<double T> foo // illegal but template<double* T> foo // legal, why?
 
what would you suggest, static_cast<f>(x)(...)?
 
double T is constant expression
 
Xeo
@TonyTheLion One is a double, the other is a pointer?
 
well, that's the thing.
 
Xeo
@TonyTheLion floating-point imprecision
 
8:20 PM
meh
 
Ell
@TonyTheLion I think only integral types are allowed in templates
 
Xeo
@nneonneo It's a reinterpret_cast
 
pointers can also be constant expressions- pointers to external linkage variables.
@Ell And pointers and references.
 
Ell
And types xD
 
Xeo
21
A: Non-type template parameters

XeoThe reason you can't do this is because non-constant expressions can't be parsed and substituted during compile-time. They could change during runtime, which would require the generation of a new template during runtime, which isn't possible because templates are a compile-time concept. Here's...

 
8:21 PM
yes, and template templates and such
 
@DeadMG double* T is not a constant expression though
 
@TonyTheLion Absolutely it is.
 
Xeo
@TonyTheLion Right. A type is not an expression.
 
you might not be able to inspect *T as constexpr, but T itself is indeed constexpr.
 
@Xeo: I don't follow. Why doesn't static_cast work here?
 
Xeo
8:22 PM
@nneonneo Because the types are completely unrelated?
 
they are both function pointers?
 
if you want to hit me over the head with a stick, it's ok.
 
you need more than that to classify them as "related".
related types need an inheritance relationship, if they are pointers (or a couple of special cases including void* and char*).
 
@Xeo but puppy said double* T is an constant expression? What are you getting at?
 
Xeo
8:23 PM
@TonyTheLion As I said, a type is not an expression.
I'm nitpicking on the example you're asking with :P
 
but elaborate, because I'm lost
 
Xeo
@nneonneo Doesn't make them related. std::vector<int> and std::vector<float> are also both instantiations of the same template - no reason for them to be related though
 
@TonyTheLion Xeo is dicking around with you needlessly. Ignore him.
 
Xeo
It's not needlessly.
 
8:24 PM
oh gawd
 
Xeo
He should get his examples right atleast.
 
fact is, template<T* p> is quite legal, and the template parameter may be any pointer to any variable of external linkage of said type.
 
That is a good question though -- can you describe what static_cast is for, without listing all the valid conversions it can perform?
 
i just saw code like this in one old DOS source : if(x1^x2) < 0 ... if (y1^y2) >=0 //(x1,y1) and (x2,y2) are 2D vectors. anybody have an idea what it does ? (except xoring and bit test sign)
 
@tigrou I believe it's an obscure notation for dot or cross product.
oh, wait, on the raw components? that's binary XOR.
if you want more then ask the guy who wrote it.
 
8:26 PM
that's a method of testing both sign bits quickly
 
two's complement doesn't have a sign bit.
 
x1 ^ x2 < 0 is true if x1 and x2 have different signs
 
lol
 
y1^y2 >= 0 if y1 and y2 have the same sign bit
 
8:27 PM
@DeadMG i think you are right, its in a 2D collision test function that check if a point is inside a polygon. unfortunaly there is not comment on these lines.
 
Hm.
 
@tigrou: it is sign-bit testing.
also remember, this is old DOS code. nobody gives a shit about standards compliance
 
I'm debating whether my camera should be a object on the Renderer, or if I should just pass new matrices in every Begin ...
.... Probably every Begin.
 
you do whatever gets you the most cycles
 
yep it was supposed to work on slow 486
 
8:29 PM
hm, it may actually be the fastest way to test if two numbers have same or differing signs
I can't think of a faster way
after all, it's basically xor eax ebx; test eax; jge somewhere
 
is if(sgn(x1)!=sgn(x2)) equivalent ? or faster, if(x1*x2 ) < 0
?
 
user142019
Hello.
 
Xeo
@LucDanton It's for conversion between types that have a relation in the type-system, where "relation" means that objects of the argument type can be implicitly or explicitly converted to the target type. Blah. Whatever :| Do you also want the explanation when one type is considered to be convertible to the other type?
 
@tigrou both are equivalent I think (though the latter might run into overflow), but neither are faster
sgn() is a full-blown function call. if inlined it's either a conditional or a bitshift
either way you have to do it twice
and the latter has a multiplication which will be dreadfully slow, esp. on a 486
 
Microoptimisations for time waste god
 
8:36 PM
@Rapptz took me a few looks to see what was so special about that page (Template)
 
Everything is a template so they don't have to rewrite everything for every container. Pretty smart.
 
@CatPlusPlus if this is a routine to do point-in-polygon tests, it might be run millions of times per second. micro-optimizations matter.
 
If you prove it with a profiler
 
I thought you all may enjoy this.
Let the PHP hate begin.
 
:frogout:
 
8:38 PM
I think somebody already posted that.
Yesterday?
 
balls
 
It's not even a funny troll attempt
 
@DomagojPandža Prezoiçely
 
That's what I get for not being here anymore :/
 
8:39 PM
@Drise When was the last time I saw you here? November?
 
@CatPlusPlus : i'm just trying to run a little piece of code on a modern script language so bitwise operation are not possible
 
@sehe A few weeks ago. Or maybe you weren't here for that.
 
@tigrou What
 
@TonyTheLion (a) What type is the member (Hint, pointer?) (b) what about external linkage evades you?
 
8:40 PM
It must be really modern language if it doesn't have bitwise operations
 
only float,double exists in that language
 
It's a horrible language
 
@sehe external linkage, I thought all the things had external linkage by default?
 
its scripting
 
8:40 PM
~scripting~ is not relevant
 
I think we should define "Gosling's law": "As an online discussion about C++ grows longer, the probability of a comparison involving Java or James Gosling approaches 1."
 
@CatPlusPlus duh.
 
It's a badly designed language with crappy type system
 
external linkage to me means it's visible across TU's
 
8:41 PM
glsl have only float and vec4 and such. is it a horrible language ?
 
@TonyTheLion local variables?!? Come on don't tell me you forgot about auto (stack) storage
 
@tigrou glsl has a purpose
 
GLSL is a domain-specific language.
 
@tigrou "modern" script language?
 
@sehe meh :(
 
8:42 PM
@TonyTheLion yes
 
GLSL is not a scripting language (there are no scripting languages but even if there were GLSL wouldn't be it) :cripes:
 
GLSL is a totally compiled one too, yes
 
ididnt say it was GLSL
 
@tigrou you are saying weird stuff nevertheless
 
It's still not a scripting language (there are no compiled languages either shut up)
Also
It's not general-purpose
 
8:43 PM
Also Cat is starting, take cover :)
@Cat does super hexagon have multiplayer or coordinated synched play?
 
@tigrou GLSL has ints.
 
It has some arcade mode for parties or whatever but I don't know what it does
 
:S
 
do we want to try it?
also, it's using FreeImage and FreeType <3
 
Xeo
@LucDanton: R Smith is foiling our plans right now in #llvm. :<
 
8:45 PM
lol
don't worry, I was expecting it
 
@BartekBanachewicz On a related note, did you ever check FreeImage's .NET wrapper?
 
Xeo
[21:40:52] <zygoloid> Xeo: i'm surprised. we should fail to constant-evaluate the lambda argument and pick false_type both times
[21:41:27] <Xeo> It's never called, though
[21:41:54] <Xeo> Although I guess the lambda expression itself isn't a constant-expression? I'd wonder why, though.
[21:44:35] <zygoloid> and if you make Zero call the lambda, or make its body ill-formed, we still accept
[21:44:48] <zygoloid> eg, make zero return T::error
[21:44:57] <Xeo> huh.
[21:45:19] <zygoloid> conclusion: we are not instantiating Zero, and we are not evaluating that expression
 
Oh it unlocks everything and enables local highscores I think
For multiple people
Aaaa I completed Hexagon
 
@EtiennedeMartel I don't .NET
@CatPlusPlus like totally?
 
The Hard level I mean
 
8:50 PM
@CatPlusPlus hard is the easiest right?
 
67 seconds of recording is 2GB :v:
Also I forgot to record the sound derp
 
@BartekBanachewicz Well, it suuuucks.
 
@BartekBanachewicz Yes
 
So it has tainted my view of FreeImage as a whole.
 
@EtiennedeMartel .NET or said wrapper? :)
 
8:51 PM
@EtiennedeMartel FreeImage isn't very good
 
@EtiennedeMartel C API is surprisingly nice for C API
 
So you're not wrong on that
 
well, it has nice capabilities
 
@BartekBanachewicz The wrapper.
 
user1182183
@CatPlusPlus Deal with it
 
8:52 PM
@GamErix So funny
So related
 
@CatPlusPlus Large feature set, but yeah, it's painful to use.
 
user1182183
@CatPlusPlus so much unrelated stuff and you tell that only to me, you really hate me :)
 
Like any C lib, it doesn't play nice wtih exceptions.
 
> auto fm = FreeImage_OpenMemory(vd.data(), vd.size());
 
8:53 PM
 
You have to RAII everything.
 
this still wins.
 
@BartekBanachewicz You leak
 
@DomagojPandža Ah I remember this.
 
I Remember April
 
8:53 PM
@CatPlusPlus hah it's quite possible. Where?
 
if(!dib)
throw runtime_error("Image failed to load");
 
oh fuck.
Did I mention I hate C? :)
 
At least the file handle or whatever OpenMemory does
 
@BartekBanachewicz I blame FreeImage, not C.
 
Oh wait it's not from file
 
8:54 PM
Because logic is for smart people.
 
1 min ago, by Etienne de Martel
Like any C lib, it doesn't play nice wtih exceptions.
 
But then you leak dib on the next throw
 
31 secs ago, by Etienne de Martel
Because logic is for smart people.
(Self-deprecation is the ultimate shield against any criticism)
 
Eh C library can't handle this any way other than setjmp/longjmp
 
8:55 PM
TIL: Bram Molenaar moved to Switzerland
 
And boy you'd be hating it then
Because setjmp/longjmp in C++ is straight UB :v:
 
basically { free_shit(); throw(); } is the only solution
 
@BartekBanachewicz No
 
@CatPlusPlus so what the hell then? :/
 
Write RAII-correct wrappers over whatever OpenMemory returns and LoadFromMemory
 
8:56 PM
@BartekBanachewicz RAII.
 
@CatPlusPlus I have to go that deep?
 
@BartekBanachewicz Of course.
 
I mean, for every part
 
8:57 PM
Every single resource
 
2 mins ago, by Bartek Banachewicz
Did I mention I hate C? :)
can I just unique_ptr it?
 
You need to do that for your C++ code too
 
or scoped_ptr?
 
With a custom deleter, sure.
 
@EtiennedeMartel yes!
a tiny light of hope
 
8:57 PM
scoped_ptr won't work
It doesn't support deleters
 
so unique_ptr
 
AFAIR
Besides it's unique_ptr only without move support so no need to remember about it
 
or any general purpose smart pointer
 
unique_ptr is general purpose smart pointer
shared_ptr and others are for specialised use cases
(I still don't like shoehorning of non-pointers into unique_ptr and then pretending they're pointers and everything is fine)
 
@CatPlusPlus But it's such a terrible name!
You totally need a specific type for that.
 
8:59 PM
@CatPlusPlus also my C++ code mostly doesn't use pointers.
 
@EtiennedeMartel It's a case of building general case on top of special case
 

« first day (877 days earlier)      last day (4070 days later) »