« first day (639 days earlier)      last day (4308 days later) » 

9:02 AM
0
Q: Integer to float conversion

rebolekI need to implement integer to float conversion but I cannot find any good sources. I cannot use any type casting, I need some solution using simple math and bitwise operations. Anyone?

*facepalm*
 
Xeo
@Neil The avatar kinda looks like *facepole*
 
@Xeo That went over my head. What looks like facepole? My avatar?
 
Xeo
The one from the question
 
@Xeo Oh
He looks like that reporter in that viral video where he's following some guy trying to interview him and he steps right into a pole
 
9:16 AM
Does "Order pizza" really mean undefined behavior, or was that just made up?
Can't remember who said that... R. I think
 
@vedosity Undefined behaviour means anything can happen. I like to pretend the compiler decides to order pizza.
You may also see it referred to as nasal demons.
 
So the nasal demons are ordering pizza?
 
Do you know what kind of "food" they can find where they live?
 
they'd better be paying for it out of their own pocket
 
detect and add source files according to file extension if general type SOURCE is given: check. Next up: generate compile commands. Then: execute commands. Then: bump version to 0.1.0: self-hosting achieved!
 
9:24 AM
I've blown pizza out my nose a few times…
never while programming though.
 
@rubenvb Whatcha making?
Version 0.1.0 on my projects often just means: this crap compiles.
 
@RMartinhoFernandes my build system thingie
 
@RMartinhoFernandes Apparently Ruben is like that, except it means it compiles itself.
 
I think I even have a crude roadmap
@Potatoswatter builds itself that is. I'm not writing a compiler.
 
Building is compiling :)
 
9:30 AM
well, it invokes the compiler itself, so... kinda :P
I'm pretty happy about the code so far. First big personal project and all. Probably has some huge stupidities all over the place...
oh wait. My version would be 0.0.1.
 
Must... Adhere... To... Own... Roadmap.
 
lol
What's 1.0 supposed to do?
 
I was in a funny mood when I wrote that list.
implicit dependencies as the Cat mentioned a while back are planned for 1.1.0.
I'm trying to avoid the KDE 4.0 release fiasco in my version numbering.
 
@rubenvb I can do a review later if you're interested.
Bashing someone else's code is fun.
 
9:36 AM
@RMartinhoFernandes Thanks, that would be awesome (probably something for in something like two or three weeks, maybe a month or something). Or if you want to bash code right away, by all means, break down my ego.
The local puppy @DeadMG already bashed my lexer. Which I knew was ugly.
 
Release versions: 2.0.0 - Conquer the world. - This is not a joke.
 
So I have this naming conundrum now. I have an enum named general_category which represents a, uh, a general category. I want to have a function to retrieve the general category of a codepoint, i.e. general_category general_category(codepoint u);. That's not gonna fly with those names. Request advice.
 
@RMartinhoFernandes get_general_category or detect_general_category. Long names, but descriptive.
is there a non-general category anywhere?
 
OK. Dropping general isn't an option then :)
 
9:41 AM
Yeah, I thought of the get_ prefix too. What irks me is that I'll have to add it to all other property queries, even those without name colisions. Consistency trumps characters saved, I guess.
 
Why have a naming convention like that?!
 
What's wrong with it?
 
You've entered a world where __TEST becomes a legitimate name
With not one but two underscores in case there was a conflict
 
@Neil even one underscore is illegal.
 
Just switch to camelCase
 
9:44 AM
snake_case for types and camelCase for functions? Ewww.
 
camelCase ALL THE THINGS!!!
 
I used to like camelCase, until I saw LLVM/Clang's code.
 
Xeo
@RMartinhoFernandes: general_category_e :P
 
@RMartinhoFernandes snake_case? Never heard that name before
 
It... looks like a snake crawling?
I may have made that up.
 
9:46 AM
@RMartinhoFernandes the obvious solution to name collisions is namespaces, but that won't save any characters either.
 
I don't remember where I've heard it.
 
The only naming convention that makes me want to tear my eyeballs out is mixing_Uppercase_and_Underscores
 
@rubenvb But there's no reason to have the two in separate namespaces. They're extremely coupled.
 
Xeo
btw
 
@RMartinhoFernandes a sub-namespace query or something.
 
Xeo
9:47 AM
Why even have a function general_category if you can just use the ctor for getting one from a codepoint... ?
 
@Xeo The ctor of an enum?
 
Xeo
nvm
 
Spark: does a enum class have member functions?
 
Xeo
New idea: don't make it an enum :D
 
it should.
 
9:48 AM
@Xeo I approve of this message.
 
You're crazy. I'd rather change names around.
@rubenvb No.
 
general_category smells suspiciously like an anti-pattern
Is it something that is going to change often?
 
@Neil It's a Unicode term AFAIU.
 
crazy... I've pretty much implemented the websocket RFC in C++ now
 
@Neil It's the official name.
 
9:49 AM
and on that note, I'd like to punch all library implementers in the face
 
Ah ok, a term I wasn't familiar with. I get those often. :(
 
I doubt they will add any categories any time soon, so yeah, it's forever.
Jun 23 at 1:15, by In silico
U+FE18: PRESENTATION FORM FOR VERTICAL RIGHT WHITE LENTICULAR BRAKCET
@Insilico do you know that names are forever immutable?
That typo is not going to get fixed ever.
They added an alias, but the primary name is typoed forever.
 
that's just stupid.
there should be a rule everywhere that obvious typos are to be treated as such.
 
@rubenvb The name acts as a unique identifier.
Not changing it prevents breakage of implementations.
 
it breaks intuition.
 
9:53 AM
If you want a typo-free name for presentation or whatnot, check for a correction alias and use that.
 
switch-case drop-through
 
Basically, the name is for computers, the aliases are for people. It makes no sense to fix typos on something intended for computers.
 
hmm... ok.
I can't seem to find the implementation recommended limit for size/nesting of initializer lists.
 
Woah, woah.
What do you want that for?
 
Xeo
10:08 AM
@RMartinhoFernandes They clearly don't like water
 
@RMartinhoFernandes wouch
@jalf permission granted
@ScottW That can't happen
 
@RMartinhoFernandes to have an idea. It's not in the list in the Appendix.
 
Xeo
10:46 AM
Man, I really get a grudge when a story kills off a good character after a comforting scene by having an alien bite her head off
Especially in a Visual Novel, with nice background pics documenting the process
 
@RMartinhoFernandes Zombie koalas are surprisingly deadly
 
@sehe thanks
 
Argh. I hate people that think const_cast is something it isn't.
 
it's sad how there are plenty of websocket implementations for C and C++, but none which can be layered on top of existing socket code. They all assume that they should handle (and hide) the low-level socket stuff
 
feels like there is some case I've missed.. anyone that might remind me?
1
A: how to init data of class that exists in stl container?

refpThe allocator has nothing to do with object initialization, it's only purpose is to allocate/deallocate memory, initialization of the give memory segment is done elsewhere. std::vector only uses the default-constructor of the type it holds in two situations: You specify the number of element...

 
Xeo
10:54 AM
@refp Too bad allocators actually do have everything to do with object initialization
 
@Xeo wait, what!?
 
Xeo
alloc.construct(dest, args); will call new (dest) T(args)
 
oh my fucking god, am I turning beyond stupid?
 
Xeo
similarly, alloc.destroy(p); will call p->~T()
 
@Xeo yeah I know, I've no idea what was going through my head when writing that. (hint the: "wait, what!?" is my reaction to reading my own writing)
if anyone wanna screenshot the part where I say the above there is a nice little note where I admit being retarded, you might use it against me in the future
 
Xeo
10:57 AM
lol, we can just refer to the transcript
 
well, that too..
 
Woot, I'm at 44000 exact.
 
Xeo
tch, I can't even find a quick answer to upvote
since I already upvoted your top4
there we go
 
If you have an object with mutexes in it, you don't make any member functions const, because you would have to use mutable on the mutexes. At least that's when I dropped the towel. Now I'm going to do some work.
 
11:06 AM
0
Q: Is it a good practice to define IHaveVirtualDestructor base class in my C++ application?

AlexI would like to define a class that looks like this: class IHaveVirtualDestructor { public: virtual ~IHaveVirtualDestructor(); }; And I would like all my interface and abstract classes to inherit this class. Is it a good practice? Or should every interface/abstract class define its own vir...

 
Xeo
C++11 alloc.construct allows emplacement construction, aka from constructor arguments other than the copy/move ctor. :)
 
Isn't there a type_trait for this?
 
As a trait, it doesn't change the types involved.
It simply tests properties.
 
@Xeo fuck off c++11! (haven't gotten around reading that part of the standard yet)
 
Xeo
11:08 AM
hehe
 
@RMartinhoFernandes but what would the purpose of a base class like that be then?
 
fucking stupid cunt bitch niggah.
 
@rubenvb Give you a virtual dtor.
 
@RMartinhoFernandes but the first class that inherits this can devirtualize it and do bad stuff anyway
 
class blah_blah_base : i_can_has_virtual_dtor { /* stuff */ };
@rubenvb No, it can't.
There's no such thing as devirtualization.
 
user784668
11:10 AM
There is.
 
user784668
But it's something very different.
 
@RMartinhoFernandes but you can define a non-virtual destructor in blah_blah_base, and every class inheriting that won't know about the virtual destructor?
 
@rubenvb You can't define a non-virtual destructor in blah_blah_base.
You don't have to write the virtual keyword, but it's virtual anyway.
 
hmm.
Ok then.
Seems stupid to enforce this though, through a Java-style base class.
 
@Xeo but the standard doesn't guarantee usage of these new functions (by the STL containers), or does it?
 
Xeo
11:12 AM
@refp The new form simply replaced the old form
 
@rubenvb This is for when you want a Java-style base class.
 
@refp there is no C++11 "part of the standard". It's pretty intertwined with everything
 
Xeo
and it does get used by emplace(_back | _front)
 
@RMartinhoFernandes lol. I now want to downvote the question because Java.
 
You want a virtual dtor. This makes it easier to put it there, making it less likely to be forgotten.
 
11:13 AM
@rubenvb the part about allocators, you stupid ****
 
Is c++11 implementing garbage collection ?
 
I'm annoyed as fuck right now
 
@rubenvb Erm, polymorphic base classes are not... evil.
@LeandroArielPezzente No.
 
@LeandroArielPezzente NO, C++11 SUCKS!
 
You only need a GC for some niche cases.
 
11:14 AM
@RMartinhoFernandes it's a base class only for the virtualness of the destructor. Write the base class you want for your polymorphism and make its destructor virtual. Sheesh.
@refp Your keyboard's * key seems to be stuck.
 
@rubenvb Yes, and you make its destructor virtual by easily deriving from an existing class. It's the same idea as deriving from boost::noncopyable just for the private ctors.
 
pfff.
C++ sucks.
 
@rubenvb there are rumors saying that I have too many flags pointed towards me, therefore I try to censor the motherfucking words that might annoy the niggerish out of some fucktards.
 
@refp You should learn to use censorable words only when they add to the point you're making. You are now officially a moron in my book for blabbering fuck all over the place for no decent reason. Brad Pitt in Se7en did not need a reason, cause that's a fucking awesome movie.
 
11:20 AM
@rubenvb eh, we both know I was a moron in your book long before this conversation.
 
You have a book?
 
@RMartinhoFernandes made you curious didn't I?
 
I have several
 
2
A: how to init data of class that exists in stl container?

refp c++11 With the new standard added functionality was granted to objects of Allocator type. One of the features added was that Allocators now allows emplacement construction, aka. construction of objects using a constructor other than copy/move. I wouldn't recommend using an Alloc...

anyone know the requirements put by the standard on containers in the STL in C++11 in regards of Allocators?
 
Xeo
> neither do I know if the standard guarantees that containers such as std::vector will actually use this new functionality.
 
11:22 AM
@refp 23.2.1/3 and 23.2.1/7 and 23.2.1/8 and 23.2.1/13
 
Xeo
It is used simply because the one argument version doesn't exist anymore, only the perfect-forwarding variadic one
Also, the emplace(_front|_back) functions practically must use this version
 
C++11 adquiring override and final keywords ... I never thougth that would ever happen
 
thanks @rubenvb
 
Why?
It's not such a radical change.
 
@Xeo see the sections mentioned by rubenvb above, they require containers to use these new features
 
bob
11:24 AM
hi. How could I easily check whether a <= b <= a+c, modulus 256 (where we take the values for a and a+c that are the closest to b) ?
 
@refp the last one seems more allocator-aware container oriented, not sure if that's completely mandatory.
 
Xeo
@refp No way they can't, the old ones don't exist anymore
 
the old ones?
 
The Old Ones.
 
oh, nevermind
I read that wrong, of course
 
Xeo
11:26 AM
The Great Old Ones
 
Killed by shoggoth.
 
Xeo
I've recently become a fan of Nyarlathotep
 
I don't like it. Too human. Too comfortable around humans.
 
"You know ... before he becomes ... tentaculy .."
I wonder what you feel about Nodens then ...
 
@Xeo @rubenvb stackoverflow.com/a/11502719/1090079 shove it to me, what have I forgotten?
I bet @DeadMG is going to appear soon telling me he down-voted it because I should have just written; "what's the matter with you boy, just implement a default-constructor!!!1"
 
11:34 AM
@refp I dunno. I just learned to find most stuff in the Standard, not understand what it says :P
CODEPAD Y U ON GCC 4.1?!?!
IDEONE Y U ON GCC 4.5?!?!
 
Xeo
> GGC 4.7.1, Boost 1.50.0
 
user784668
@Xeo And old Python.
 
@Xeo wow awesome. Thanks.
 
Xeo
Who cares about Python
 
11:37 AM
Why?
 
liveworkspace.org.. hate it
 
user784668
>>> print("Hello", "world")
Hello world
 
@Fanael erhm, what language/interpreter is that?
 
user784668
@refp Python 3.2.3
 
user784668
liveworkspace.org uses Python 2, where print is a statement with weird syntax, not a function.
 
11:39 AM
@Fanael whaa they changed so print is a function? cool
 
@Fanael Python 2.7.x is still actively supported everywhere.
 
Well, it's Python 2. It's like a different language.
It's not dead.
The latest release was last April.
 
user784668
Then let the user choose between Python 2 and Python 3.
 
like comparing perl6 compared to perl5
 
@Fanael they don't let the user choose between C or C++ versions. Write a letter.
 
11:41 AM
the page is still beta
 
fuck. GCC released 4.5.4. I need to build that shit now :(
 
I'm about to deploy my own service with the same functionality as codepad/ideone/liveworkspace.org... FYI
there are so much things which bugs me about those three
 
@rubenvb What?
 
How did I not notice for two weeks
@RMartinhoFernandes I build toolchains for MinGW-w64.
GCC 4.5 is a bitch with CLooG and PPL.
it needs ancient other options.
 
Python 2 is in maintenance-only mode. There will be no more minor releases, it ends with 2.7.
 
11:43 AM
I don't think I kept those around.
 
user784668
@rubenvb But C++03 and C++11 are way more compatible than Python 2 and Python 3 are. Besides, C++03 is unmaintained, Python 2 still receives bugfixes.
 
@Fanael write a letter.
 
C++ is still swimming in backwards compatibility poo, Python took the opportunity and flushed the toilet on major release.
 
That's a stinky analogy.
 
@CatPlusPlus So do anyone actually use Python 3 yet?
otherwise, I'd say flushing the toilet is overrated
 
11:55 AM
Yes.
 
@CatPlusPlus Anyone serious? None of the big python projects I've seen have given Python 3 much thought so far
 
Arch's "python" is version 3.x. You need to explicitly install "python2"
I think that's one of the almost nonexistent cases they keep an old version of software in their repo's
 
Large projects are moving slowly with phasing out older Python versions, but they're moving.
 
user784668
@rubenvb You need to explicitly install "python", too.
 
@Fanael but "python" without a version is by default the 3.x version.
 
12:00 PM
Every time I've tried to use Python, I've run into code that didn't run on 3.x
 
how does facebook handle member death? I've always wondered...
 
I can't recall seeing anything that required 3.x
So seems to me a better analogy would be that C++ is trying to freshen up its backwards compatibility poo, perhaps dillute it with more fresh water, whereas Python tried to climb out, and ended up falling face-first back into it
@rubenvb I think they have several ways to handle it, but you can send them some documentation on it, and they'll either close the profile or turn it into some kind of memorial thing
 
But someone has to do that, right?
 
yep
relatives, I'm assuming
 
so the last person in a large group of friends that dies, who has no children, is doomed to haunt FB forevermore!
 
first link doesn't find anything in FB's help center... go figure. Second link is very informative :)
 
12:24 PM
Wait, @RMartinhoFernandes is writing a Unicode implementation now?
 
Xeo
yea
Jul 11 at 1:03, by R. Martinho Fernandes
@Xeo It's my turn to be messing around with Unicode. AFAICT, there's always a lounger doing it, this season it's me.
 
Well shiiit.
 
wow: ./stdio.h:1010:1: error: ‘gets’ undeclared here (not in a function)
 
Xeo
@rubenvb I think you broke something :P
 
pacman -Syyu ... let's hope this fixes everything :P
 
user784668
12:29 PM
@Xeo Why? That's great.
 
it has a glibc update. Fun stuff
glibc 2.16. Now nobody will be able to use my linux builds :D
 
user784668
Who cares about your linux builds anyway?
 
D programming lang comes w/o backwards compatibility, does anyone use it?
 
user784668
@Nils No.
 
I hope nobody. Most distros (Fedora,Debian) have official MinGW-w64 packages. Arch has mine in the AUR.
Arch is dangerous... sometimes.
 
12:35 PM
@Fanael ...
 
user784668
@sehe …
 
In C++ 03 std::vector has const_iterator, but no cbegin(), cend()?
 
Xeo
yes
 
How come?
 
Xeo
begin() and end() have const-qualified overloads
 
12:38 PM
because C++.
 
@Nils they didn't think of it in time
 
in related news, I'd love to have std::cbegin and std::cend regardless
 
Fuck. Upgrade did not fix this.
 
user784668
@sehe Yup, they did the same mistake again.
 
Xeo
@sehe std::end(const_cast<Container const&>(c)) :P
 
12:40 PM
hm yeah. Also what about std::rbegin and std::rend?
 
Xeo
@ecatmur Not every range offers reverse iteration
 
ah and in 11 begin() end() are still overloaded, but there is cbegin()/end() to explicitly have a const it?
 
user784668
@Xeo static_cast
 
Xeo
yes
@Fanael No.
 
12:41 PM
lol @rubenvb
 
user784668
@Xeo Yes.
 
Xeo
@Fanael Why do you think const_cast exists? To remove or add const (or volatile) and nothing else
static_cast is more powerful and not needed
 
Ell
static_cast<> can't remove const?
 
Xeo
It can
but it can't only do that
 
@Xeo better to have an add_const function template
 
Xeo
12:43 PM
it can much more, and if you only need constness, a const_cast is what you should reach for
@ecatmur Yeah, deduction would be nice for const_cast
Since for the most part, you want to flip what you have
and if not, you could always specify yourself
 
user784668
@Xeo How? There are four possibilities.
 
Xeo
for the most part
though really const_cast largely gets abused outside of adding const
 
user784668
Frankly, that should be implicit_cast, not static_cast, and certainly not const_cast.
 
how implicit would the use of implicit_cast be?
explicit_cast would be a better name for it
 
maybe I should not use libiconv for the linux build
but that would overcomplicate the build scripts
frack
 
user784668
12:47 PM
@refp It's usually called implicit_cast because it'll refuse to do anything an implicit conversion can't do.
 
@rubenvb use windows and you don't have to worry about building things, you'll be busy fighting malware.. (yes, 2003 called and wanted their "anti windows"-sentence back)
 
@refp uh, no. I need GCC for Windows. That, you build on Linux. Building it on Windows takes about a day. On Linux? Four hours, 7 toolchains.
 
user784668
@refp But it seems that the name explicit_cast is not unheard of.
 
@rubenvb uh I'm jokin' bro
 
user784668
Really it's explicit_implicit_conversion.
 
12:48 PM
@refp not funny bro.
 
powerful_explicit_implicit_conversion_of_awesomeness<int*> (0);
 
user784668
@rubenvb Pay somebody to build it on Windows.
 
@Fanael I haz no moneez
 
pay someone to build it on linux
<- could use some extra cash
 
what the hell. It's an error in stdio.h itself
 
12:49 PM
@Fanael Lol. Yeah right.
 
ffs
 
Does anyone know how to detect cables in a wall? I can't find phone connection in my new apartment.
 
Ell
metal detector? or is that pipe?
 
Xeo
@StackedCrooked Aren't there devices for that?
 
I think there are.
 
12:51 PM
oh wait, maybe I need -std=c89 or something
 
user784668
@rubenvb Works for me with no -std.
 
@Fanael glibc 2.16.0?
 
@StackedCrooked There's got to be an emacs command for that.
 
user784668
@rubenvb Aye.
 
user784668
>> gcc -x c - -S -o -
#include <stdio.h>
int x = gets;
        .file   ""
<stdin>:2:1: warning: ‘gets’ is deprecated (declared at /usr/include/stdio.h:638) [-Wdeprecated-declarations]
<stdin>:2:9: warning: initialization makes integer from pointer without a cast [enabled by default]
<stdin>:2:1: error: initializer element is not computable at load time
 
12:55 PM
@StackedCrooked But seriously, do what I did when I had the same problem, and call your landlord to send you the electrician who did the wiring in your apartment.
 
@Fanael this sucks.
libiconv sucks.
GNU software in general sucks.
libiconv has its own stdio.h. Go figure.
 

« first day (639 days earlier)      last day (4308 days later) »