« first day (655 days earlier)      last day (4297 days later) » 

9:01 AM
I wonder if you could copy the instance: auto copy = s;
 
Sure you could. Dang. But prior to C++11, it practically was a Singleton :)
 
@FredOverflow template<typename T> void foo(T); foo(s);
 
In C++11 you can do decltype(s). :P
And in C, you can pass it to a function by value.
It will make a copy.
Oh wait no.
You cannot.
C++03 had templates so it was possible.
 
boost::any copy = s;
Admittedly any_cast is somewhat problematic here.
 
Singlesuck
 
In C you shouldn't do OOP anyway.
C is awesome.
 
lol, can't argue with that part.
 
C is awesome at being sucky.
 
@StackedCrooked It may be the case that unnamed classes don't have external linkage (unless using a typedef).
 
@RadekSlupik Wasn't Quake 3 written in "OO C"?
 
9:10 AM
I don't know.
But Facebook and Wikipedia are written in PHP. Doesn't make PHP good.
 
@StackedCrooked Like any derivative of C.
 
@ManofOneWay oh? How come?
 
@jalf I did fine on the test, and I talked to your boss on the phone today.
 
nice, so coming for an interview?
 
@jalf It'll be somewhat more informal, since I still won't be able to start working before January next year. I'll have a look at the office and see in more detail what you are doing. :)
 
9:21 AM
ah ok
sounds good :)
 
I have to work on some PHP code right now that was written by somebody who parses XML with strpos() and explode().
 
16
Q: Why are singleton objects more object orientated?

SawyerIn "Programming In Scala", the author said: One way in which Scala is more object-oriented than Java is that classes in Scala cannot have static members. Instead, Scala has singleton objects. Why is a singleton object more object orientated? What's the good of not using static membe...

My Scala Singleton question got closed as a duplicate of this?!?
Haven't read the question yet, but the title is... OMG
 
The people who closed it didn't either.
They see "Scala" and "singleton" in the same post and YES SAME WORDS OCCUR IN TITLE = DUPLICATE
Idimorons.
 
9:37 AM
Chat gone bananas.
Hi.
 
OMG you're posting from March 2013!
Did the world end in 2012? Who won the US election?
 
@ecatmur Batman
 
Are there flying cars? Jetpacks? Did the singularity happen?
 
@jalf How do you know? Are you with me in the present?
@Zeta No. No. Yes, the singularity happened in the 80s.
 
@ecatmur of course the world didnt end, silly.
How could he possibly post.
 
9:43 AM
@RadekSlupik I could if I was the one that ended the world. whistles
 
@R.MartinhoFernandes But then the question becomes... Have you ever played Tic-Tac-Toe?
 
10:07 AM
@FredOverflow Yeah... silly syntax and weird things tend to get upvoted like crazy.
 
Hmm, Valve changed Steam's subscriber agreement. I'm not happy.
 
@R.MartinhoFernandes: What did they change this time?
 
They're limiting class action lawsuits (something that apparently the US Supreme Court as ruled as enforceable, WTF? They should just shoot those judges), and they're trying to go against EU laws regarding refunds and resales.
Scratch that, they should just shoot all the lawyers.
 
Good morning.
 
10:23 AM
Good afternoon.
 
Xeo
mornin'
 
Hi
Okay, I've written a 4-page commentary about the Google Style Guide and why it sucks.
 
Xeo
@Mysticial: The newsletter really gets one a good amount of upvotes
 
@kbok good for you
 
Now waiting for feedback. This is going to be fun.
 
10:27 AM
@kbok Where?
 
@R.MartinhoFernandes In a text document ? I'm not sure to understand what's the question.
 
can we see it online somewhere
 
Xeo
@kbok Post it online so we can give you feedback
 
that is the question
 
@kbok that does not answer 'where' it is, just what format it is
 
10:29 AM
Yeah, that makes sense.
I'll prepare it for online viewing and upload it then.
 
'I have a lot of money', 'where?', 'Euros' <-- does not make sense
 
It is not possible to overload a virtual function. This is tricky (for me at least!)
 
@Damian I may be rather confused by JavaScript right now, but I am sure you are wrong
 
virtual void foo(int, int); virtual void foo(double, double);
afaik, that's valid
 
Xeo
it is
same with virtual void foo(int); void foo(double);
one is virtual, the other not
 
10:31 AM
oh wow
 
well, makes sense. overloaded functions have separate signatures
:)
 
which is why return value covariance works, because the return value isn't part of the signature (?)
 
@ecatmur indeed
 
@Xeo Thank you!
@TonyTheLion Thank you!
 
71
A: C++ preprocessor: avoid code repetition of member variable list

PaulWhat you need to do is have the preprocessor generate reflection data about the fields. This data can be stored as nested classes. First, to make it easier and cleaner to write it in the preprocessor we will use typed expression. A typed expression is just an expression that puts the type in pa...

This preprocessor stuff is really ugly.
I think maybe just generate code from an xml data definition would be a cleaner solution.
 
Xeo
10:36 AM
@ecatmur correct, though it is part of the function type :)
 
@Xeo well, it's the function type... depending on what exactly you want that to mean :P
 
using type = void(); type f; leaves little to the imagination.
 
Anyone ever tried to work with generated code for things like reflection?
 
@Xeo It depends on how high you are on it as well as the type of question. That constructor question was #3. And from what I've seen, pedantic C++ questions don't attract at lot of votes unless it's extremely simple. You got about 13 votes on it so far. More than I initially expected.
 
One day I'll understand why reflection is so desired.
 
10:39 AM
@Nils Some people in my company use reflect for that
 
reflect?
 
@R.MartinhoFernandes Serialize data to disk, to network, etc
 
Nope, still not convincing me.
 
Xeo
@Nils You don't need reflection for that
Only compile-time introspection
 
10:41 AM
yeah let's call it introspection
 
just sounds like a mess to me
 
Heh, I just disclosed the name of my employer. I'll leave that to your detective skills.
 
but you need to get all the members of a class.
 
I take reflection to mean "inspecting types at runtime".
 
People confuse the two; introspection would get rid of a lot of the desire for reflection.
 
10:42 AM
@kbok cool :)
 
@Nils Not at runtime.
 
Xeo
@Mysticial Yeah, simple questions get tons of upvotes.
 
And if you're doing it at compile-time, instead of generating code for inspecting the members of a class, you can just generate code to do the serialization.
 
@LucDanton I still think that typedef void (*type)(); type f; is far clearer :p
 
@ecatmur That's a different thing.
Also, shame on you.
 
Xeo
10:43 AM
@ecatmur That's something else
 
oh, bother :(
 
@R.MartinhoFernandes yeah, nobody said at runtime
 
Xeo
in using type = void(); type f;, f is a function declaration
 
@ecatmur Simple questions will get a lot of votes from SO and the rest of the network. In-depth questions are more suitable for the Reddit audience. (surprisingly)
 
type* f; would achieve the same as yours. As is made clear with the star.
 
10:45 AM
@Xeo ah. Can I do that with a typedef?
 
typedef void type();
 
Xeo
@ecatmur typedef void type();
damn, slow internetz!
 
In computer science, reflection is the ability of a computer program to examine (see type introspection) and modify the structure and behavior (specifically the values, meta-data, properties and functions) of an object at runtime. Reflection is most commonly used in high-level virtual machine programming languages like Smalltalk and scripting languages and also in manifestly typed or statically typed programming languages such as Java, ML, and Haskell. Historical background The earliest computers were programmed in their native assembly language, which is inherently reflective as it is...
 
Xeo
But as you can see, a using-alias is just plain easier to wrap your head around
 
Also, void typedef type();.
 
Xeo
10:47 AM
hrhr
 
@Xeo I never knew you could do that with a typedef! Even works in C. Well, well.
 
"You wont need experts"
I guess asking for extensive PHP experience is quite a way to ensure you that you don't get experts :)
 
PHP or not, "You won't need experts" sounds like a really bad thing.
 
> The best and brightest are expensive, moody and prone to boredom.
 
ah, good to know that the people working at Zend are just as dangerously ignorant as the people using PHP
 
10:52 AM
I like this one:
> Dynamic typing significantly reduces the amount of code you need to write and error conditions you need to check for.
Apparently, not caring about errors significantly reduces the number of error conditions you need to check for.
 
@ecatmur So the reason to use PHP is effectively "incompetence is cheap"?
That's actually a pretty good tagline. They should put that on the PHP website
 
Just ran 5.8 km in 24°C which felt like 30°C.
I'm not made for that yet.
9.16 km/h
which is about 2.5 m/s which is half of what pro athletes do
Conclusion: I suck. I need to run more!
 
Or care less.
 
11:12 AM
lol
 
11:42 AM
lol
 
11:53 AM
LOL
 
Xeo
@R.MartinhoFernandes, can you test the second linked code here with Clang?
 
@Xeo it works fine here (libstdc++ 4.6.3, clang 3.2pre r161057
 
Xeo
@rubenvb Cool, post that as a comment. :)
I thought from the beginning that this was a bug
since both declarations are exactly the same
 
damn, this is disappointing. :D
thanks
 
doesn't give any warnings on -Wall -Wextra -pedantic either.
neither of the snippets.
Not even linker errors.
 
12:18 PM
-8
Q: C++ Program offensive to people

GravityBotI have a C++ program like this #include <iostream> using namespace std; int main(){ string ques, ans;cout << "Enter Question" << endl; cin >> ques;if(ques == "Do I look fat?")cout << "Moooooooo" << endl;} My friend made it for me. I gave it to my girl and sh...

 
lol
trollbait
 
What the...?
@rubenvb: Yes. I would love to see a new close reason as stated by Stefano: stackoverflow.com/questions/11758990/…
 
Xeo
@Zeta Nuked.
@ScottW You're one slow dog.
 
@ScottW I usually do about 25-30 minutes over 5-6 km (2.8-4,0 m/s). Today was just not my day :(
I didn't run due to thesis deadline and last exams etc, for about two months.
and before that I don't remember if I got to it anyways :P
I ran in the rain two days ago
it was still warm enough
So I only got soaked. I kept running. Had about 1km to go.
I can't run right in the cold (breathing gets messed up) and if it's too hot, I slow down immensely... I'm a wuss.
Right. I'm just happy I can run each other day without not being able to take a flight of stairs afterwards :P.
@ScottW Runner's high. Free (and healthy) morphine cocaine :)
 
12:39 PM
@Xeo is that Accelerator on you avatar?
 
Xeo
@yurikilochek aye
Cool that somebody recognizes him :)
 
indeed)
 
Stopped watching index at episode 2 for some reason..
 
Wish me luck building a multilib MinGW-w64 :)
 
@ScottW problem with cocaine, it's very more-ish
 
12:42 PM
stopped watching 24 at episode 3
 
@Xeo: That's Accelerator? Damn, I would never notice. Only watched the episodes, I can't remember him to look like that
 
Xeo
@StackedCrooked The anime is crap in comparision to the novel
 
@Xeo confimed
 
Xeo
@Zeta What? Long, fluffy white hair, evil grin...
@yurikilochek Oh, you read the novel?
 
at the beginning of the secind volume at the moment.
that was anough to tell the difference
enough*
 
Xeo
12:44 PM
hehe, you got a long time to go yet
I recently finished the 4th volume of the "second season", aka TESTAMENT series
And Accelerator is one of those characters that has an awesome character development
 
Yeah, that is noticable even in anime
idk why i decided to read the novels two years after watching it
 
@Xeo: Hm, yeah, you've got a point. Should start to read the novel, though.
 
Xeo
@yurikilochek Ooh, just wait until after the God's Right Seat arc. :)
So much awesomeness
 
@yurikilochek: Maybe you want to know how the story goes one - at least I want to know what happens after the second season.
 
@Zeta get right to it then
I actually got bored at the secong season
that Church stuff and all
we need more mikoto
 
12:49 PM
God's right seat was the last episode in the second season. There were sooo many cliffhangers in this episode. It's frustrating.
 
Xeo
@yurikilochek Indeed, she hasn't been very present in the TESTAMENT series :(
@Zeta I think it was only Vento entering Academy City, right?
 
thats a pity :(
 
So according to NASA, 0 = 0.00000000000000001 …
 
Xeo
lol
 
@Xeo Well, I don't remember everything. I spoilered myself the same evening and read almost everything on the Index wikia. But now that I think of it... Could be Vento. Dang.
 
12:51 PM
comparison epsilon it probably is
 
Xeo
@Zeta Vento was the one woman in yellow
With the chain on her tongue
 
@yurikilochek Yup. But the whole header is fucking weird
 
Xeo
But really, the God's Right Seat Arc is so much awesome
I think it goes till Vol 22
Yeah, vol 13 - 22
Really long arc
 
@Konrad the decided to reimplement std::valarray
 
@yurikilochek Badly
 
12:54 PM
indeed
in the topic of light novels
 
Xeo
@yurikilochek *preimplement, FTFY
 
hum
class Vector : public std::vector< X >
 
Xeo
(most likely, anyways)
Oh, nvm
@yurikilochek Hai?
 
I read Sword Art Online just before Index
it was glorious
 
inheriting utilities is baaaaad, m'kay
 
Xeo
12:57 PM
Oh, I have to read that too
 
there are lots of hate on the on net though
 
Xeo
It seems to be really good too
Too bad I spoiled myself in a thread on /a/
 
"Two years worth of ..."? :D
 
Xeo
@yurikilochek hm?
 
If you have no idea what that is about then you are fine
 
Xeo
12:59 PM
Is the novel still ongoing?
 
its a reference to a very bad sex scene that got cut out of the final release thankfully
 
Xeo
Anyways, gotta go, see ya
 
VM Y U FREEZE ON ME???
 
@Xao kay
 
ah wait, it's just paging like crazy.
Virtualbox Y U NO HOTPLUG RAM?
 
1:10 PM
hmm. I have a formula which produces a value hat requires that some internal value is set to 1e-310 … however, this value cannot even represented as a long double … what the fuck?!
 
Round to 0, imo.
 
@SamDeHaan No, that would result in an error. The formula is log(x, 10) * -10, and the result of this formula is > 3100 which implies that the value of x must be < 1e-310
(the code (Python) isn’t mine and I cannot examine the value of x)
 
You're trying to port from python?
 
@SamDeHaan No, I’m just using some Python code
and I’m trying to understand the result
 
Ah, gotcha. I thought you were trying to find how to store that 1e-310, in something other language.
 
1:16 PM
well
I’m actually trying to find a flaw in my reasoning since clearly this value cannot be stored
but it appears to be
 
Well, Python will do what it wants.
 
@KonradPudolph what platform is that where 1e-310 cannot be represented by long double?
 
80-bit fp can store 1e-310 no problem.
 
no platform – Python uses double internally to represent floating-point numbers
@ecatmur wait, how?
@yurikilochek the minimal value long double can represent is one hundred orders of magnitude bigger: it’s around 1e-30
 
what double alre you talking about? IEEE 754 64-bit double indeed can not, but intel has its own kind of 80-bit floating point numbers, that are fine.
as far as i know long double maps mostly to them
 
1:22 PM
I think the denormal point is about 1e-4930
 
plenty of space,
 
@yurikilochek wrong. They might be used as in-between results by the CPU, but are never stored in cache or RAM as 80 bits.
That explains little computational differences between platforms/compilers.
Unless you're writing Intel intrinsics.
long double is mostly just double without any additional benefit.
 
@rubenvb isnt that only due too alignment reasons? long double is just 80 bits stuffed inti 16-byte memory block?
 
surly after 64-bit floats, you would go up to 128-bit :S
 
1:25 PM
@yurikilochek point me to an implementation where long double is 80 (or heck, 128 bits)
 
In C and related programming languages, long double refers to a floating point data type that is often more precise than double precision. As with C's other floating point types, it may not necessarily map to an IEEE format. long double in C History The long double type was present in the original 1989 C standard but support was improved by the 1999 revision of the C standard, or C99, which extended the standard library to include functions operating on long double such as sinl() and strtold(). Implementations On the x86 architecture, most compilers implement long double as the 80-bi...
> On the x86 architecture, most compilers implement long double as the 80-bit extended precision type supported by that hardware (sometimes stored as 12 or 16 bytes to maintain data structure alignment). An exception is Microsoft Visual C++ for x86, which makes long double a synonym for double.[2] The Intel C++ compiler on Microsoft Windows supports extended precision, but requires the /Qlong‑double switch to access the hardware's extended precision format.[3]
 
seems i was right
 
Anyways, there's usually no real advantage of a larger floating point type.
rescaling your maths will help a lot more.
 
1:27 PM
if you are expecting types to be of a given size, you are going to have a bad time
 
128 bits over here.
 
@rubenvb some scientific computations might require more recision than 64 bits provide, but then one should consider implementing variable precision arichmetic in software
 
@yurikilochek right. Use GMP/MPFR or whatever.
It seems GCC on Windows follows GCC on Linux.
12 bits 32-bit and 16 bits on 64-bit.
I was talking out of my ass.
5
 
a suppose you mean bytes
12 and 16
 
1:31 PM
yeah, that.
Byte me.
:D
 
Oh god, this screen within a screen thing is a fucking mess. I now have eight instances of screen running, and I think I'm in a triply-nested session, but I have no idea which one is. And I only need two.
2
 
Robot got lost in the computer?
 
You are experiencing visual recursion
:D
 
Infinite intro-visual recursion
 
1:46 PM
> Cannibal Corpse also had a brief cameo in the 1994 Jim Carrey film Ace Ventura: Pet Detective, performing an abridged version of their song "Hammer Smashed Face". Being a death metal enthusiast, Carrey insisted that they make an appearance in the movie. - wiki page
 
0
Q: What does the returned value of the strcmp mean?

user16948I know that strcmp returns... A value greater than zero indicates that the first character that does not match has a greater value in str1 than in str2; And a value less than zero indicates the opposite. But what do those positive or negative numbers mean? for example what does 2 mean?

Not a bad question, but I have a hard time believing this needs to be explained the way the top-voted answer explained it.
 
Then downvote the top-answer.
 

« first day (655 days earlier)      last day (4297 days later) »