« first day (460 days earlier)      last day (4490 days later) » 

9:00 PM
int x = 512; // BAM! broken
 
@Pubby it's probably a bug either way. But my way hides the error. Don't do what I said
I have compiled and run my first GCC programs on my Windows box! Hooray!
now to forage for food.
 
Thx all. Will stay with manual packing though as I just realized that I only need the four lower bytes ^^
 
@NikiC memcpy clarifies intent, use it anyway
 
Me, I prefer masks and shifts.
 
@MooingDuck Is there a remotely elegant way to copy only the lower four bytes of an integer with memcpy? I can only think of strange hacky solutions. I think the shifts + masks are quite straighforward.
 
9:05 PM
(x & 0xFF000000) >> 24 makes quite clear what byte I want.
 
What's the name of that disease when people just can't stop using pointers all over and then get bitten because pointers are messy and people don't know how to work with them, but they think they know and SPEED COPIES THINGS ARGHOJRTHKe.
 
@RMartinhoFernandes ignorance?
 
9:21 PM
I mean it. Just look at this question:
2
Q: C++, why am I getting access violations after modifying newly allocated objects?

KlashnikovKidAlright, so I'm currently working on a game and ran into a memory issue after refactoring some of the code today. It uses a component based design and I was modifying how the components were allocated and passed off to entities. Originally some components were allocated as member variables withi...

Look at all those pointers!
For no reason whatsoever!
 
Ell
in c++, why doesn't undefined behaiviour cause a compiler error?
 
if he was that smart (and with us at runtime)..
 
Because a lot of UB can't be reliably detected by the compiler.
 
Ell
oh yeah
 
user142019
And because it's valid code.
 
Ell
9:24 PM
I forgot UB was mostly runtime stuff
silly me
what a stupid question :O
 
user142019
It's just that its behavior isn't defined.
 
So compiler writers won't spend the resources required to make it an error in the few cases where it can be detected.
 
How do I ask a question?
 
user142019
shoots
 
thank you
 
9:25 PM
@WTP And that's why the compiler is allowed to make it an error.
 
hey people, I'm about to refresh my C++ skills in the next few days, can anyone recommend a concise text (may be a book) for name lookup/overload resolution/ctor autogeneration/etc mechanics?
 
So, whether it's valid code or not is pretty fuzzy.
 
user142019
@RMartinhoFernandes the standard says you are right.
 
Another proof that upvoting is broken.
12
A: Is a null reference an instance from a class?

Etienne de MartelYou're reading it the wrong way. instanceof always evaluates to false for null references. From the Java specification (emphasis mine): At run time, the result of the instanceof operator is true if the value of the RelationalExpression is not null and the reference could be cast (ยง15.16) to ...

Took me 30 seconds to write, got 12 upvotes in 3 minutes.
 
Ell
why is that broken? o.O
 
9:34 PM
Because I don't deserve that much rep for what is essentially a quick Google search.
 
Ell
well, it's a good answer :L
 
There are answers with much more effort put into them that don't have as many.
 
Ell
hmm I see
 
@Ell It's almost a RTFM.
 
Ell
maybe niche areas up-votes should be worth more rep?
 
9:36 PM
Ha, one of the comments even claims it's a "perfect answer".
Upvoting should cost rep.
Less than downvoting, of course.
 
@EtiennedeMartel How would you bootstrap the system?
 
@RMartinhoFernandes It's already been bootstrapped.
 
Though, bootstrapping is no longer needed now...
 
But then I would probably give a small amount of starting rep to people.
Instead of just 1.
 
9:54 PM
@EtiennedeMartel Here, have another vote to make it even more "broken". :)
 
You represent all that is wrong with this site! I hate you! You're despicable!
 
Ell
Maybe a bit harsh ;)
 
Hi - if you've read The C++ Programming Language - what does this mean: "string literal can be assigned to a `char *`. This is allowed because in previous definitions of C
and C++ , the type of a string literal was `char*`. Allowing the assignment of a string literal to a `char*` ensures that millions of lines of C and C++ remain valid."
Especially the last part
 
Ell
well a string is an array of chars which decays into a char* allowing the assignment
(I'm rubbish at C++, somebody tell me I'm wrong)
 
It simply means you can do char* x = "blah";
 
Ell
10:05 PM
but I never use char*, only ever std::string
 
But normally, you could not.
 
@LewsTherin It means that if that they had changed the rules for string literals, it would have broken too much old code
 
Because "blah" has type char const[5], not char[5].
I think that was removed in C++11.
 
indeed it was
 
Ell
so what is it now? is the string literal type different?
 
10:06 PM
@DeadMG Ah lol thanks
 
@Ell Now char* x = "blah"; isn't valid.
 
yes, it is a constant array of char
 
@RMartinhoFernandes Why not?
 
Ell
but const char* x = "blah"; is?
 
People had 13 years to fix their code.
@LewsTherin Because char const[5] cannot be converted to char*.
 
10:07 PM
it violates const correctness
 
Oh right.. so it isn't a necessary convention or something..
 
Ell
the compiler enforces const correctness
 
it is a holdover from before const existed
 
In response to the #MegaUpload shutdown... #Anonymous has apparently made http://www.justice.gov/ unreachable. We truly live in a digital age.
This is funny.
 
Thanks guys. Mucho clearer
Megaupload shutdown? What?!
 
Ell
10:09 PM
I don't even use megaupload o.o
 
@Ell You may.. indirectly
 
So, the site of the US Department of Justice is brought down by hackers, and you guys are worried about MegaUpload? ;)
 
I have lots of mega that I need to upload :(
 
the US authorities shut down Megaupload for copyright infringement
and it's currently being sued for about half a billion dollars
 
Ell
oooh that must hurt
 
10:11 PM
Agh, where is my samurai sword
Omfg. when was megaupload down?
 
Ell
who is pro-sopa/pipa here?
 
ok, now I will require an explanation by someone whom speak spanish about this NSFW
 
I don't speak Spanish, but Portuguese is close enough.
 
Ell
lol
 
Ok, my Spanish is not enough to get that.
 
10:14 PM
oh damn
 
Also, what Spanish do they use on Spanish Wikipedia?
(In Spain, they have at least four different Spanishes).
And one of them also counts as a Portuguese.
@LewsTherin Since earlier today.
The question is: who types "Dicks" into the Spanish wikipedia?
 
this is the big problem with SOPA and PIPA, and US internet policy
 
@RMartinhoFernandes Was working earlier for me, and I'm not even finished what I was watching. This is very bad...
 
their lawmakers are idiots, so I in the UK am getting fucked
 
Ell
4 types of spanish? Valencian, catalunan, basque... regular?
 
10:16 PM
lol
 
Ell
@DeadMG as am I :)
@RMartinhoFernandes what are the 4 types of spanish? :P
 
@Ell Castellaño, galego, catalán, and something else I don't remember.
 
@DeadMG I too. If other sites get affected life would suck like a bitch.
 
CEO of Megaupload is a DJ en.wikipedia.org/wiki/Swizz_Beats
 
thank god I don't use any of these download sites
 
Ell
10:18 PM
cant google et al just migrate all of their servers to the uk? (I know you cant just migrate, but would that allow them to bypass SOPA?)
 
@TonyTheLion You don't stream then? Or torrents?
 
@LewsTherin what would I stream? No, I don't do torrents
 
@Ell SOPA is actually targeted against sites not in the US. It's easier to bypass SOPA in the US
 
@TonyTheLion Do you watch tv?
 
@LewsTherin yes, but not on my PC
the only thing I watch, is the occasional YouTube video
 
Ell
10:20 PM
I dont watch TV really
all I watch is youtube
 
@TonyTheLion Ah you are lucky, I assume you live alone then.
 
oh yea, and I use Spotify, but AFAIK, that's not illegal
 
@Ell: ah, the fourth is euskara (basque).
 
@LewsTherin nope
 
@TonyTheLion Everything is illegal!
 
10:20 PM
@RMartinhoFernandes then this chat is also illegal! Run!!!!
 
@TonyTheLion Then you have your own tv ha ha
 
@Ell I'm pro-SOPA, if and only if they move the friggen comma that currently makes it illegal to enable or facilitate theft
 
@TonyTheLion lol
 
Ell
@MooingDuck I really have no idea what SOPA really does, I'm just being told everywhere that its bad, bad, bad...
 
@Ell The current wording of SOPA makes virtually everything illegal.
 
10:21 PM
riaa.com is also down.
 
Ell
@MooingDuck so why for it? o.O
 
@MooingDuck does it make working illegal?
 
@Ell in general, it blocks websites whos primary purpose is illegal activities, especially those outside of the US
 
@MooingDuck SOPA doesn't say what is illegal or not. It delegates that to something else. SOPA only gives power to act against it.
 
otherwise I want it! Never have to work again! LOL
 
10:22 PM
@RMartinhoFernandes true
 
Ell
@MooingDuck but it makes everything illegal o.O youtube, facebook et al? or is that just a lie
 
@TonyTheLion it allows enforcement against anything that "enables" theft. Some argue that email enables theft. (theft includes copyright violations)
 
Some sites are still streaming.. for now
 
Sorry if off topic: can anyone remember the quote (or who said it) that goes something like "be forgiving in what you receive, and strict in what you publish" - with respect to data interchange or something related
 
@Ell due to a misplaced comma, yes
 
Ell
10:24 PM
oh dear :s
sorry g2g now
its my bed time :D
nighty night
 
@MooingDuck now, let's think about it, if they really wanted to take down the whole internet with that, why don't they just pull the plug on the internet, instead of making a fancy bill that supposedly disguises the fact that, what they really want is to remove practically every website existing on the face of this earth. Because, if you read all the stuff on SOPA, then that's the idea that is supposedly behind this.
 
Guys.
SOPA didn't pass.
 
@TonyTheLion I have read SOPA. It's written to target piracy. However, the wording is terrible
 
They don't need SOPA to take anything down.
 
@Ell HAHA
 
10:26 PM
Because they're taking stuff down without SOPA.
 
So they are targeting only the source then?
 
@RMartinhoFernandes only domestic sites, SOPA targets foreign primarily
 
Also, I think a lot of opinion get's entered into what SOPA is and what it isn't. I wondered how many people that write extensive articles on the bad-ness of it, have actually read and understood the proposed bill. Or have they just read the first sentence and then written their interpretation of it???
 
@MooingDuck What do you mean foreign?
 
quoting SOPA SEC. 102.a "a foreign Internet site or portion thereof is a `foreign infringing site' if--
(1) the Internet site or portion thereof is a U.S.-directed site and is used by users in the United States;
(2) the owner or operator of such Internet site is committing or facilitating the commission of criminal violations punishable under section 2318, 2319, 2319A, 2319B, or 2320, or chapter 90, of title 18, United States Code; and
(3) the Internet site would, by reason of acts described in paragraph (1), be subject to seizure in the United States in an action brought by the Attorney Ge
 
10:28 PM
@MooingDuck right, well, I haven't read it, and I don't know, but I just get annoyed at people making it seem like the world is going to end if this bill were to pass.
 
It wouldn't?
 
@TonyTheLion The world won't end, but it'll ruin lots of companies and seriously shake things up
 
@TonyTheLion Because that's what it means..
 
@LewsTherin that's your interpretation of what it means...
 
@TonyTheLion that's the problem. Its unclear and interpretable. So it's whatever a judge says it is. All it takes is one ticked-off judge, and google is down.
 
10:29 PM
@TonyTheLion I'm not alone in having that interpretation I would think
 
@MooingDuck I know, and I can agree that it would do damage to a lot of companies.
 
@MooingDuck Google is foreign?
 
@MooingDuck yea, well, seems like that is then what it is.
 
@LewsTherin Don't worry, the pro-SOPA are not alone either.
 
@RMartinhoFernandes no, Google is EVERYWHERE.
 
10:31 PM
anything that doesn't end in .com .org .us or .gov or something equally asinine is what the bill says is foreign
 
@RMartinhoFernandes SOPA primarily targets foreign, but not entirely. Google currently falls into the "promotes theft category"
@Kurt that's not even remotely true. I actually linked the definition of foreign a moment ago
 
@MooingDuck Just like MegaUpload, no?
 
@RMartinhoFernandes yeah
 
That's what I remembered reading at least
Or maybe that was PIPA
 
So?
What's SOPA for?
 
10:32 PM
@Kurt I haven't read PIPA
@RMartinhoFernandes making it so Americans cannot access websites that promote piracy. (Google links to pirates, ergo, google is scared)
 
@RMartinhoFernandes making soup of the internet :P
 
A felon hid in your basement without you knowing? Burn it down after removing him
 
@MooingDuck My point is, don't they have the powers to take the sites down already?
 
@RMartinhoFernandes current laws make streaming videos illegal (megavideo). SOPA makes linking to MegaVideo illegal as well (google)
@RMartinhoFernandes not for linking to pirates. Also current laws do not affect non-US websites
 
And forbidding linking to pirates is the problem of SOPA?
 
10:34 PM
@RMartinhoFernandes one of several.
 
Really? Wikipedia was down because of that?
 
@RMartinhoFernandes if a user posts "how to pirate" on Wikipedia, and Wikipedia gets reported, Wikipedia is removed from the internet and then notified.
@RMartinhoFernandes under current laws, Wikipedia is notified, and then have 30 days to remove it before there's consequences
 
@MooingDuck See, now that's something else.
 
@RMartinhoFernandes There's a lot to SOPA
 
Well, you could have highlighted the most troublesome parts from the start.
 
10:37 PM
@RMartinhoFernandes there's a lot of troublesome parts
 
Right, like "make everything illegal".
 
@MooingDuck Can anyone really stop it? I doubt it...
 
another that it requires "reasonable precaution" against piracy. But doesn't say or hint at what that entails. So one angry judge later....
 
I don't know how it works in the US, but here laws have that kind of wording, and then there's regulations that determine what the criteria are.
Regulations are easier to change than laws, so they can adapt to changing circumstances.
 
@RMartinhoFernandes I don't know how it works in the US either, but people are scared
 
10:41 PM
@LewsTherin FWIW, it was stopped.
The problem is that there will be a new one.
 
@RMartinhoFernandes I hadn't heard they voted yet
 
@MooingDuck A bunch of supporters have already given up on it.
 
I wonder when we start paying to use yahoo or google
 
@LewsTherin I heard no reason to believe we would begin to
@LewsTherin and nobobdy uses yahoo anyway, except for email
@LewsTherin and I love your name
 
What's yahoo?
Isn't that a Houyhnhnm word for human?
 
10:49 PM
the Google of the late 20th Century
 
@RMartinhoFernandes one of the two sites everyone went to for email before gmail
 
@MooingDuck Thanks :)
 
@LewsTherin I WIN AGAIN LEWS THERIN
 
I wouldn't be surprised however - maybe youtube then lol.
@MooingDuck flicker
 
@LewsTherin I'm just finishing book 4. again.
 
10:51 PM
@MooingDuck Very nice! Currently I'm reading A Song of Fire and Ice, after them would get WoT for a reread! :D
 
@LewsTherin I haven't read books 4/5 of SoFaI yet
 
I have Game of Thrones on my desk since last August. That thing starts slooow.
 
Song of Ice and Fire, not Song of Fire and Ice
 
@MooingDuck Just about to finish GoT.
 
@DeadMG whatever
 
10:53 PM
@DeadMG Stand corrected, never actually looked at the title
@RMartinhoFernandes It does indeed. It gets better though. But apparently A Clash of Kings I heard is better
 
@DeadMG The first time I read the books I thought they were going to be about the two swords. Took me a long time to figure it out. Putting those two swords in just makes everything confusing
 
@MooingDuck What swords?
 
@LewsTherin Ice and Fire
 
Plus, Martin doesn't seem to have any intention of finishing the series any time soon.
That puts me off.
 
@RMartinhoFernandes $$$$$
 
10:55 PM
@MooingDuck Haven't read about Fire yet mmn
Does it ever say who Jon's mother is?
I don't want another author to die before finishing the series himself
 
@LewsTherin Fire is... I forget. I think it gets melted and given to Joffery in book 2 or 3. I forgot who owned it before that
I love that I can now make MSVC compile my projects with GCC! AWESOME!
 
@MooingDuck God I hate that brat..
@MooingDuck Wait MSVC on Linux?
 
@LewsTherin nope, GCC on windows
 
@MooingDuck Oh right.. it's on windows too. I like my msvc compiler enough lol
 
@LewsTherin GCC makes faster code sometimes. Also makes sure my code is portable. 99% of the time I use the default compiler still
 
11:01 PM
I hate switching between compiler - PITA
brb
 
@LewsTherin It just adds a command to the "tools" menu that compiles as GCC and shows the output in the output window
whoa, glad I caught that typo: for(unsigned int i=1; i<data.size(); +i)
 
PHP is pissing me off.
 
PHP would drive mad anyone unlucky enough to have to code in it
 
I suppose it might do me good to look into Python as an alternative.
 
@MooingDuck lol
Wait, which one is the typo? The 1 or the +?
 
11:15 PM
hrm. MSVC is giving me undefined behavior about shifting by 32. But it's in an if block that is always false for the same condition that would cause it to shift by 32. So that UB can never execute. Does UB apply to operations or the entire TU?
 
Heh.
 
@RMartinhoFernandes the +
 
@MooingDuck Interesting.
Is it a warning saying, "This code will give you undefined behavior?" Or are you actually getting undefined behavior?
 
@Maxpm it's just a warning. That code could never execute
 
UB only occurs when the condition actually occurs at run-time
 
11:17 PM
@MooingDuck It can apply to everything!
 
@DeadMG alright, it's safe to leave it then
@RMartinhoFernandes uh oh, you two are contradicting each other
 
@MooingDuck The puppy is correct in practice.
 
@RMartinhoFernandes bah, I'll try to get rid of the warning, since I ought to do that anyway
 
No compiler will go out of his way to punish you.
Well, Hell++ will.
That's the main design goal of Hell++.
 
"However, if any such execution contains an undefined operation, this International
Standard places no requirement on the implementation executing that program with that input (not even with regard to operations preceding the first undefined operation)." verified
@RMartinhoFernandes I can't find that
google search keeps returning this room
 
11:22 PM
@MooingDuck Because it only exists in my head.
 
because it's a concept, not a real thing
 
"Hell++ compiler" returns 200 hits though, you're getting somewhere :D
 
Implementing Hell++ is not really feasible.
 
but the basic idea behind Hell++ is a Standard-conformant C++ compiler which goes out of it's way to be as unfriendly and surprising and annoying as possible
for example, 13-bit bytes, etc
 
@DeadMG go for 64 bit so all types are the same
no wait, not a power of two, 65 bits. That'll fry a lot of Meta-code
 
11:24 PM
Duh.
 
@RMartinhoFernandes it's feasable as long as there's no backend. Just a front-end. With warnings.
 
@MooingDuck The point is not the warnings!
And even then, it's not feasible.
It's supposed to detect pretty much all UB.
 
@RMartinhoFernandes well, that would be tricky
 
How else could it do all the rigamaroles it's supposed to do?
 
`> Hell++ hello_world.cpp`
`File has one or more instances of undefined behavior.`
`>`
 
11:28 PM
It compiles pretty much everything that is not ill-formed.
 
@RMartinhoFernandes actually, if you allow false-positives....
 
Only errors it produces are syntactic and static type errors.
 
is there a way to tell GCC that a template class will inherit such and such members? Or do I have to change everything to this->data?
 
Hmm?
@MooingDuck Ah, a kid spoiled by MSVC :)
Yes, my dear, that's how C++ rolls.
 
@RMartinhoFernandes absolutely :/
@RMartinhoFernandes lets see how well a global replace does
@RMartinhoFernandes I can see why MSVC won't change thier template instantiation. There's a lot of pros to their way. Only found one con yet
 
11:34 PM
Yeah? What about errors that are not caught when they should?
Or is that your con?
 
@RMartinhoFernandes the con I found was when it got confused about my template recursion, though that might have been a seperate bug: connect.microsoft.com/VisualStudio/feedback/details/714003/…
 
What about, say, initializing members that don't exist. cough
 
@RMartinhoFernandes pft, it would have found that if I tried to use the function
 
That's still a con, isn't it?
 
@RMartinhoFernandes eh, yeah
 
11:38 PM
Woot, I'm a "Guru" on memory leaks.
 
is there a way to tell GCC how to format the file/line that a warning is on, to make it play nice with MSVC? FILENAME(LINENO): warning <everythingelse>
 
Not that I know of.
I usually change settings on my editor for that, not on the compiler.
And by usually, I mean, never.
 
@RMartinhoFernandes can't change the compiler or the IDE
 
Well, AFAIK, you can't do that on GCC.
 
I've taken to alphabetizing my includes. Is there something else that makes more sense?
 
11:46 PM
I sort them by scope first, and then alphabetically, ignoring the leading cs in the C libraries.
 
@RMartinhoFernandes by scope? I haven't been ignoring the cs in the C libraries
 
@MooingDuck First headers from this project, then any third-party libraries, then boost, then std.
 
@RMartinhoFernandes makes sense, prevents accidental "working" if std/boost is before project
 
And obviously, in some_file.cpp, the very first one is always some_file.hpp.
 
@RMartinhoFernandes gah, I have warnings all over of "comparison of unsigned expression < 0 is always false". It's based on a template parameter, so I can't figure out how to make the warning go away besides explicitly disabling it for GCC
 
11:54 PM
Oh, I had that before. That one is annoying.
Now, if only I could remember where that was...
I know I solved it, so the fix is somewhere in one of these files...
Argh, can't find it.
I would count that one as a bug.
 
@RMartinhoFernandes bug in GCC?
 
Right.
Silly annoying warnings oughta count as bugs (well, at least outside of Microsoft).
 
GCC needs #pragma warning disable(<errornumber>) like visual studio
gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html or #pragma gcc diagnostic disable <errornumber>
 

« first day (460 days earlier)      last day (4490 days later) »