« first day (465 days earlier)      last day (4500 days later) » 

4:00 PM
ok, I have a question about SFINAE, if you have something like this, then the call with the int as type parameter, will allow the std::string template to be removed from the overload resolution set. However if you just a bunch of specialized templates, and one was on std::string wouldn't that essentially be the same thing? Or even just have overloaded functions. What advantage does SFINAE actually bring?
 
@Xeo I think the chat "Last Seen" will always show a few seconds if you have the chat window open. (which I do on about 3 different machines) But my SO profile showed "7 hours ago" when I woke up.
I don't think I've ever closed the chat window on one of my machines since November...
 
@TonyTheLion SFINAE is generally used to allow one overload to work on a broad category. So yes, using SFINAE just for a single type (the opposite of broad, really) isn't much more useful than overloading (rather than template specialization, which isn't used much for function templates).
 
I don't get SFINAE... you can specialise templates to handle certain data types in a certain way, is it nor normal behaviour for a default template to be used?
or have I, yet again, missed the point?
 
Xeo
@LucDanton And aside from the fact that partial spec doesn't work there
 
@thecoshman ignorance is futile!!!!!!!
 
4:05 PM
@Xeo That's included in 'isn't used much for function templates' :)
 
Xeo
But I found a nice way to actually do 'partial specs' on function templates...
 
Since one whole kind of specialization is disallowed, yes.
@Xeo Yeah, I call it SFINAE personally.
 
Xeo
Just manually do what is done during overload resolution and partial ordering.. make the template parameters arguments :D
Oh, and it was actually a good idea to recompile Clang.. I have a seamingly fully functional constexpr keyword now :)
 
@Xeo does it work in static_assert?
 
Xeo
It works in template arguments and static typedefs inside classes
 
4:09 PM
@LucDanton so, you could SFINAE on all types that have operator() defined, for example
 
Xeo
lemme test static_assert
@TonyTheLion I'd use SFINAE for that
 
or all types that have a certain function, say foo() defined.
 
Xeo
SFINAE
Yeah :)
 
@TonyTheLion That one would be tricky. You can detect if a type has exactly one operator() defined, but that's it.
Same for any member function, overloading muddles the water. Data member are fine though.
 
Assume I have a lot of objects that needs to be replaced at some point. Option 1) Remove all the old and create new. Option 2) Overwrite and reuse the old objects. I am currently using option 1 but someone pointed out it might be wasteful and fragmenting way to work. What do you think? Which option would you use?
 
4:11 PM
static_assert really doesn't asserts at the point it is declared , or I must had got it wrong :)
 
user784668
../llvm/configure [...] --enable-target=x86,x86_64,arm
 
user784668
What backends would you expect to get compiled?
 
Xeo
@LucDanton But you know what you want to call a functor with (usually)
 
My usual is the opposite of your usual.
 
@MrAnubis whut?
 
4:12 PM
I never write code that relies on the presence or absence of operator() for exactly that reason btw.
 
@mantler if you use an object pool (like from boost), you can release old objects and create new ones without the fragmentation
 
user784668
Hint: the answer is not "IA-32, AMD64 and ARM ones".
 
@Xeo was that yeah, static_assert works with a constexpr?
 
@kfmfe04 So there is a possibility that I fragment the memory using option 1?
 
Xeo
@rubenvb The "yeah" was directed @ Tony
 
4:14 PM
confumblement!
 
Xeo
t.cpp:6:17: error: static_assert expression is not an integral constant
      expression
  static_assert(f(), "x");
                ^~~
t.cpp:6:17: note: non-constexpr function 'f' cannot be used in a constant
      expression
t.cpp:3:16: note: declared here
constexpr bool f(){ return true; }
               ^
:(
 
@mantler sure, because in between the remove old and create new, the OS could be messing with you
 
@Xeo nooooooo!
 
@Xeo yes the very same problem also baffled me long time , at last i had skipped using constexpr function
 
Xeo
Okay, so it's partially working.. strange
It works in template arguments...
 
4:15 PM
@mantler also, memory allocation/deallocation is expensive if you are doing tons of small objects - pools will also help you there
 
@Xeo you mean it's parsed. There's nothing really constexpr about it yet.
 
@Xeo you mean that code thing should've work?
 
@kfmfe04 Ok, thank you. I will look into using a pool.
 
They did that to bail out people using GCC 4.6 libstdc++
 
@mantler but pools only work (or works better) when you can have a certain point where you want to clear out all the old
 
4:16 PM
@MrAnubis yes his example should work. Of course.
 
@mantler np
 
@kfmfe04 Yes, I have that in our application.
 
@rubenvb damn , I was doing the same thing , but I thought I had got it worng :D
 
Xeo
wtf..
That's strange
 
@MrAnubis always check at least two compilers :)
 
Xeo
4:17 PM
Just some minutes ago X<f()> worked
 
@kfmfe04 Basically, a setting gets changed and a small object gets recreated. And the old object is removed.
 
Xeo
LOL
 
@mantler if it's only ONE object at a time, just update the object - no need for pools or deallocating/reallocating
 
Xeo
AHAHAHA
 
@kfmfe04 Oh, sorry. No it is several objects that gets affected.
 
Xeo
4:19 PM
@rubenvb: constexpr is fully functional
As long as you don't #include anything, that is.
 
@mantler still, why not change those objects?
 
user784668
@Xeo: 24 seconds and about 70 MB of memory.
 
Xeo
@Fanael D:
 
@Xeo whut? No you're freaking me out.
 
Xeo
@Fanael How can that be?
 
user784668
4:20 PM
@Xeo I don't know.
 
Xeo
@rubenvb It's true
constexpr int f(){ return 1; }

int main(){
  static_assert(f(), "x");
  static_assert(!f(), "x");
}
t.cpp:10:3: error: static_assert failed "x"
  static_assert(!f(), "x");
  ^             ~~~~
 
user784668
What linker are you using?
 
Xeo
whatever make uses
#include <type_traits>

constexpr int f(){ return 1; }

int main(){
static_assert(f(), "x");
static_assert(!f(), "x");
}
 
@mantler it totally depends on what happens after that setting is changed: if the objects are reusable, just change them. If the kinds of objects that are supposed to be created depends on the setting, making updates messy, then you can consider using a pool.
 
user784668
@Xeo make has nothing to do with a linker, actually.
 
Xeo
4:22 PM
t.cpp:6:17: error: static_assert expression is not an integral constant
      expression
  static_assert(f(), "x");
                ^~~
t.cpp:6:17: note: non-constexpr function 'f' cannot be used in a constant
      expression
t.cpp:3:15: note: declared here
constexpr int f(){ return 1; }
 
user784668
I assume this means your system's default one?
 
@thecoshman Well, it is more complicated than I write here. Think a pool where all objects in the pool needs to be updated. Some of the objects might not be in the pool at the time of update.
 
Xeo
Aye
@rubenvb: And if I add the #include after the constexpr function, it works again
 
well that's just retarded. Does libstdc++ mess with constexpr or static_assert?
or are you using libc++?
 
Xeo
I use libc++
 
user784668
4:22 PM
Could you give me the output of ld -v?
 
@mantler makes sense then...
http://www.boost.org/doc/libs/1_48_0/libs/pool/doc/html/index.html
is easy to use and well-docmented - try it out
 
@kfmfe04 @thecoshman So it is hard to explain. But I understand your points!
 
Xeo
Oh.. it may very well be that libc++ maybe does #define constexpr const somewhere..
That'd be very strange, though
> GNU ld (GNU Binutils for Debian) 2.20.1-system.20100303
@rubenvb Lemme test with libstdc++
Works with libstdc++
 
well, I use libstdc++, but really it seems any header screws it up
huh?
 
Xeo
Seriously, wtf oO
Same file as pasted before (with #include at the top), and the static_assert triggers
 
user784668
4:25 PM
Mine is 2.21.53.20110823; but I doubt that the difference could so big if the versions don't differ that much.
 
Xeo
AHAHAHAHA
libc++ really does #define constexpr somewhere :D
 
so libc++ has a workaround for constexpr missing in Clang
 
Xeo
If I #undef constexpr, it works all dandy
 
good to know. I defined constexpr as empty for my purposes. This is great news!
 
Haha, Chrome froze and crashed and took all tabs with it.
So much for isolation.
 
Xeo
4:26 PM
I wonder if I should make this a question and wait for @HowardHinnant's answer :>
 
@Xeo haha, you are a pest aren't you. This is probably a clang bug because it should set __has_feature(cxx_constexpr) to true, which it doesn't
 
Xeo
Seems like it
But I still wonder why libc++ #defines constexpr
 
libc++ uses that to check every semi-optional feature
@Xeo most stuff works with constexpr defined as empty. Just not static_asserts and stuff
 
user784668
Really, that's weird.
 
user784668
2.5 GB and 1h 10min vs 70 MB and 24s?
 
Xeo
4:29 PM
Okay, it's #define constexpr const
In some central header
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
#define constexpr const
#endif
In __config
 
The problem is, Howard can't sensibly remove that if the __has_feature thing is set incorrectly. Probably some corner cases still don't work, but most stuff does now.
 
Xeo
@rubenvb maybe because Clang 3.1 isn't out yet. It's just SVN head
 
@Xeo it's still a bug.
 
Xeo
aye
 
He uses Clang TOT too IIRC
 
Xeo
4:32 PM
lol, libc++ even emulates static_assert
if the compiler doesn't support it
 
Yeah, it was finished a long time ago and even works with GCC 4.4.
 
user784668
@Xeo: were you building Clang under Debian?
 
Als
Hola
 
user784668
@Xeo: because if that's the case, it makes even less sense than it already does.
 
Does sizeof include the space required to hold the vtable pointer for an instance of a class if there is one?
 
user784668
4:40 PM
@SethCarnegie Yes.
 
Thanks
 
user784668
Not that it's hard to check it yourself.
 
Als
@SethCarnegie: Why would you bother about it?
 
@Als if it didn't then placement new wouldn't work very well when using sizeof to determine how much space you need to allocate
@Fanael experiments can go wrong and make you come to some erroneous conclusion so I asked here
 
Als
@SethCarnegie: Yes, So you already know it does, trolling like litb are you?
:)
 
4:43 PM
@Als no I didn't know, but it would make sense
 
Als
@SethCarnegie I see
sizeof returns size of an object, while vptr is a part of the object so it's logical.
@TonyTheLion: Tiger...Lion..Leopard..coming soon? :P
 
@Als I wasn't sure if the vptr was part of the object or not, or if it was implementation-specific
but anyway
 
I want to go there :)
 
wow - that's a big drop - where is it?
 
Als
4:46 PM
@SethCarnegie: it is implementation specific.
But if a vptr exists it will be accounted for in the size.
@TonyTheLion Somewhere in the middle-east is it?
 
@Als in Singapore
it's a hotel, with that on top
 
Als
Geez!
 
Als
Hmm, I couldn't afford it even if I am there, I am pretty sure of it.
 
user784668
17
Q: Is it a good idea to compile a language to C?

aelguindyAll over the web, I am getting the feeling that writing a C backend for a compiler is not such a good idea anymore. GHC's C backend is not being actively developed anymore (this is my unsupported feeling). Compilers are targeting C-- or LLVM. Normally, I would think that GCC is a good old mature...

 
4:49 PM
Is it seriously not possible to link a sodding dynamic lib without getting root to add it to ld.conf?
 
Als
Quick close votes needed on this one:
-2
Q: Pros and Cons of pointers

AhamedI have come across few languages like C, Java and Objective C. C and Objective C have pointers, while java does not. Why java is restricting the use of pointers? However it should have some mechanism of accessing objects from memory. Can anyone explain me the Pros and Cons of pointers? Thanks.

 
user784668
Any idea why so many people think that compiling to C will cause any trouble with collecting garbage?
 
@Fanael bcuz C haz pointerz and it is sukc
 
Als
@Fanael: Because they are spoilt by the comfort of using higher level languages which provide garbage collection.
 
user784668
Normally you keep some metadata for GC somewhere in the object. Guess what? You can do that in C just fine.
 
Als
4:52 PM
okay a Question, keeping with the tradition of the room its no way related to C++.
 
user784668
Gonna write an answer, I guess.
 
Als
Planning to watch Godfather Part 3 tonite, is it worth watching?
 
user784668
Or not, cuz I'm too lazy.
 
@Als no
Al Pacino also has pointers, like C, therefore he is suck
 
Als
@SethCarnegie: But he was good in first two parts, Yes I watched them just sometime ago.
 
user784668
4:54 PM
@Als You're wrong. He was never good.
 
Als
@Fanael: He being good or bad is a perception, So there is no question of wrong or right.
 
The first two were good but not the last one
 
Als
@SethCarnegie: First two were good yes.
 
user784668
Oh.
 
user784668
can haz llvm wiht clang just finished.
 

« first day (465 days earlier)      last day (4500 days later) »