« first day (790 days earlier)      last day (4173 days later) » 

8:00 PM
> Consider replacing point = (point++); ... with just ...
@Mysticial Oh, I didn't even catch that, why do people write these nonsense increment/assignment pairs?
 
@FredOverflow The core question is actually very good. Why wouldn't you be curious at the behavior? Why doesn't it work left-to-right, or differ with compilers.
The only problem is actually us.
The question is sooooo goddamn common, that we are just conditioned to destroy them all on sight.
 
@FredOverflow I learned this from Koenig's book: while (begin != end) *out++ = *begin++;
 
the real problem is that nobody yet eliminated the UB from the Standard.
@StackedCrooked iow std copy
 
user142019
Hey @pontifex, can I get a follow back!
 
8:03 PM
@StackedCrooked Ew, postfix increment.
for (; begin != end; ++begin, ++out) *out = *begin;
 
sbi
@FredOverflow Finally found it.
 
@DeadMG Yep.
 
@sbi Aw. Is that his wife?
 
@DeadMG That too. :)
 
@StackedCrooked ...but by then it was old (K&R1 shows strcpy that way, and I'm not at all sure it was new even then).
 
sbi
8:04 PM
@FredOverflow It's a dog, silly!
(And no, I dunno. Never met her.)
 
@DeadMG Although if that was the case, then we get people complaining about the million and a half questions that 100+ votes over x = x++. (As is the case in Java.)
 
user142019
@FredOverflow teacher uses it all the time so it must be good!
 
@Zoidberg'-- Postfix increment is one of the stupidest ideas in computer science, ever.
 
sbi
@Zoidberg'-- Did that, for a moment, look like I tweeted that, or is that hallucination caused by sleep deprivation kicking in?
 
Speaking of S.Meyers, can't wait for his next book :)
 
8:05 PM
@FredOverflow I disagree. I use almost exclusively postfix in the same matter that @Stacked showed.
 
sbi
@FredOverflow Write a strcpy() loop as elegantly as K&R did without it.
 
@FredOverflow I wonder if the overhead caused by post-increment is elided since a copy to *out needs to be made anyway
 
Nobody plays games here or what
 
user142019
@sbi I first oneboxed your retweet but I thought that could be confusing.
 
@Mysticial while (begin != end) *out++ = *begin++; is a pessimization of for (; begin != end; ++begin, ++out) *out = *begin; Why would you ever use it?
 
8:06 PM
We might need to revoke your nerd certificates
 
@FredOverflow Because C must do everything in as few expressions as possible
 
@CatPlusPlus [steamid] thek2win
 
@DeadMG Right, and C is the gold standard of computer science :)
 
sbi
@Zoidberg'-- But I didn't RT in "RT: ..." style!
 
user142019
@sbi but that’s how Stack Exchange oneboxes it. :P
 
8:07 PM
@FredOverflow It's because I don't use for-loops unless it's a very obvious iteration.
 
@StackedCrooked Depends on the compiler. The point is, if you use prefix increment instead of postfix increment, you don't have to worry about this.
@Mysticial We must have different definitions of iteration.
 
If anything, I use do-while loops a lot.
 
user142019
@FredOverflow maybe because there may have been performance differences and the first C compiler wasn’t that smart?
 
user142019
(But I’m not a performance expert.)
 
@Mysticial I have found exactly one use case for do/while: convert an int to a string.
 
sbi
8:08 PM
@Zoidberg'-- But how did you even get hold of this address? Obviously, I didn't post it, and when I look at it in my tweet stream, the address provided under "Details" is the original one.
 
@Mysticial Really? I use them rarely.
 
@Zoidberg'-- Are you implying that postfix increment is faster? :)
@StackedCrooked I don't even bother teaching do/while to freshmen anymore, it's a waste of time.
 
user142019
@FredOverflow no, that it might have been in certain circumstances about forty thousand years ago, when C was invented.
 
user142019
But again, that’s just some random guess. :P
 
@FredOverflow I don't even teach at all. Now you!
 
8:09 PM
@StackedCrooked Come to think of it. I only use do-while loops in low-level code. Most of the high-level stuff is while-loops with an occasional for-loop here and there.
 
@Zoidberg'-- I assure you that postfix increment was never faster. What possible reason could make it faster? It's more complicated than prefix increment.
 
user142019
I never use postfix ++. I find it ugly and confusing.
 
sbi
@StackedCrooked For built-ins, there is no overhead. It's only a problem if you have UDTs, like list iterators and such, where increment is expensive, might not be inlined, and throws off the optimizer.
 
@Zoidberg'-- Exactly. Have a cookie.
 
user142019
@FredOverflow Sorry, government blocks cookies.
 
8:10 PM
Okay, have a banana then.
 
sbi
@FredOverflow It's the right thing to do when you need to increment but also need to get at the value as it was before. Just as in strcpy().
 
user142019
Fucking government y u try to control interwebs.
 
user142019
A bullet is what they deserve.
 
user142019
@FredOverflow thank you very much. I like bananas.
 
@Zoidberg'-- Controlling things is their thing.
 
8:11 PM
@sbi I guarantee you that it's possible to write a fast strcpy without postfix increment. It may not be as concise, but I don't consider that a problem.
 
user142019
What do you call an annoying banana?
 
user1182183
hm, will calling the destructor from the constructor in a struct cause problems?
 
@Zoidberg'-- bannoyna?
 
user142019
@FredOverflow bananananana
 
@GamErix What do you mean by that? You cannot call the destructor of *this, because *this doesn't live yet.
 
8:12 PM
@GamErix huh?
 
user142019
Or, in JavaScript, baNaNNaN.
 
sbi
@FredOverflow Of course, it is possible! It's also possible to write the thing in fucking assembler, after all. It may not be as concise, but you won't consider that a problem.
@Zoidberg'-- That's a Canandadian banana.
 
user1182183
@FredOverflow struct x { x(){ if(something_went_wrong){~x()}} ~x(){destroy_struct_info}};
 
user142019
@sbi I really have no idea. I think I’m using a weird Twitter client.
 
@sbi I just consider postfix increment to cause way more confusion than benefit, that's all. Now go write a postfix increment strcpy if that's what makes you happy ;)
 
user142019
8:13 PM
I think retweets have IDs just like regular tweets.
 
When I was starting out as a programmer I consumed many books and absorbed their teachings. Now when I open a book I find myself much more resistant to the ideas presented. I wonder if I'm becoming an old dog.
 
@GamErix UB.
 
@GamErix It makes no sense to call the destructor when the constructor hasn't finished yet. Just throw an exception.
 
sbi
@FredOverflow Really, is that it? When I present logical arguments, you reply with "But I find it confusing!"? That's cheap.
 
@sbi No, I find that almost everybody I talk to gets the semantics of postfix increment wrong.
 
8:14 PM
@GamErix Shooting yourself in the foot with this, you are.
 
sbi
@Zoidberg'-- Yeah, that would seem to make sense. But the web GUI won't show them.
 
user142019
Nope, the website will redirect instead.
 
sbi
@FredOverflow Yeah, but that's because you're mostly talking to students!
 
user1182183
@Borgleader :/ then what would the best way be ? I cannot return values in a constructor..
 
Best way to what?
Use rule of zero
 
8:15 PM
@sbi Students with years of experience also get this wrong. If such a basic language feature is so easy to get wrong, I think it's a bad language feature. Just look at all the nonsense in C and C++ books about postfix increment.
 
sbi
> If roads were collapsing all across the United States, killing dozens of drivers, we would surely see that as a moment to talk about what we could do to keep roads from collapsing. If terrorists were detonating bombs in port after port, you can be sure Congress would be working to upgrade the nation’s security measures. If a plague was ripping through communities, public-health officials would be working feverishly to contain it.
> Only with gun violence do we respond to repeated tragedies by saying that mourning is acceptable but discussing how to prevent more tragedies is not.
 
user142019
I don’t need any operators besides NAND. Just give me NAND already!
 
Your primitives should be exception-safe and know how to clean up after themselves, and non-primitives should be built upon those primitves
It's not rocket science
 
@GamErix Throw an exception.
 
8:16 PM
@FredOverflow Doesn't postfix increment just increment the value and return the original (un-incremented) value?
 
@FredOverflow There's a lot of nonsense in lots of C and C++ books, and postfix increment is really the least of their problems.
 
@Borgleader If we're talking Java and C#, then yes. Congratulations, you're hired!
 
sbi
@FredOverflow Hell, programmers with a decade of experience in C++ get exception safety all wrong, if they get anything about it at all. Are exceptions therefore a bad feature we ought to not to use?
 
user1182183
@FredOverflow hm k :/ but maybe you can tip me something other? -> ideone.com/ZD3OHP
 
@FredOverflow What does the C++ version do differently?
 
8:18 PM
Visual Studio is not a C compiler and never will be. :P — Mysticial 6 secs ago
 
user142019
@GamErix nice buffer overflow.
 
@sbi I don't know, but it's not like there's a difference between simple prefix exceptions and confusing postfix exceptions :) It's hard to just ditch exceptions, they're everywhere in the standard library.
 
user1182183
It's ised like scripts.push_back(Struct(blabla));
 
user1182183
@Zoidberg'-- huh?
 
@sbi "The right to drive on a non collapsing road" is not really part of the US constitution.
 
sbi
8:18 PM
@FredOverflow return codes.
 
user142019
@GamErix here:
 
user142019
            char string[MAX_PATH];
            GetCurrentDirectory(MAX_PATH,string);
            lstrcat(string,"\\libraries\\pluginsa\\scripts\\");
 
@Borgleader You don't know when the increment happens until the next sequence point.
 
user142019
If length of GetCurrentDirectory is MAX_PATH, you’ll have UB and you deserve it because you don’t use something sane.
 
@sbi There's way more difference between return codes and exceptions compared with prefix and postfix increment.
 
user1182183
8:19 PM
@Zoidberg'-- so I should check if string.len is < MAX_PATH-len)(\\libraries\\pluginsa\\scripts\)+filename)?
 
user142019
@GamErix no
 
sbi
@EtiennedeMartel Roads are still maintained as if it was, though.
 
I think he accidentally an extra word
 
user1182183
MAX_PATH-1?
 
@Borgleader Wooops.
 
user142019
8:20 PM
std::string getCurrentDir() {
    char string[MAX_PATH];
    GetCurrentDirectory(MAX_PATH, string);
    return std::string(string);
}
 
user142019
Something like that. Use std::string, not char[].
 
user1182183
ah thanks
 
That earlier code is buffer overflow even when it doesn't hit MAX_PATH
 
user1182183
ye I try, ut you know.. MS.
 
@Zoidberg'-- No.
 
8:21 PM
@sbi Yes, but you're missing the larger ideological issue, here.
 
It's not MS fault that you're bad
 
user142019
Then just getCurrentDir() + "\\libraries\\pluginsa\\scripts\\". Also use Boost.Filesystem instead.
 
How about you show us the errors? Do they stark with LNK? Then you need to add the required libraries. — FredOverflow 37 secs ago
 
sbi
@EtiennedeMartel Actually I think he addressed it quite nicely.
 
user142019
@DeadMG what’s wrong with it?
 
user1182183
8:21 PM
there is totally nothing that returns a std::string so I have to use char*
 
@sbi I'm reading it right now. Just a second.
 
@Zoidberg'-- Never mind, I derped.
 
user142019
@GamErix use Boost.Filesystem like any sane C++ programmer.
 
@GamErix No, you have to convert to std::string.
 
sbi
@EtiennedeMartel I am still at it. I mean the part that I quoted addressed this quite well.
 
user1182183
8:22 PM
@Zoidberg'-- is it standalone? :$
 
user142019
@GamErix headers and two libraries to link to. :P
 
user1182183
@Zoidberg'-- ah k
 
@GamErix Maybe because WinAPI is not C++
 
user142019
But I think in VC++ they are automatically linked if you include <boost/filesystem.hpp>. (Not sure though.)
 
user1182183
@CatPlusPlus you're right :/ I'm bad :F
 
8:23 PM
@FredOverflow For any who may care, a second generation picture of Persephone: i1212.photobucket.com/albums/cc452/jcoffin01/Persephone.jpg
 
sbi
> Higher populations, more stress, more immigrants, and more mental illness were not correlated with more deaths from gun violence. But [...]: States with tighter gun control laws appear to have fewer gun-related deaths.
Ha! Who'd have thought?
 
user142019
Also, y u fopen without std::unique_ptr.
 
user142019
Use std::fstream or some alternative that doesn’t suck.
 
@JerryCoffin I thought you meant there were pictures of her on the CD :)
 
@sbi As obvious as that may seem, most studies actually show the exact opposite.
 
8:26 PM
wait, are you implying that std::fstream is not a giant pile of suck?
 
user1182183
bah 600 cpp files takes loong to compile
 
@FredOverflow Only one.
 
user142019
@DeadMG no, I’m implying it is.
 
> To start, open INDEX.HTM
lol
 
user1182183
now boost added to it . yay ;F
 
user142019
8:26 PM
memset? Really? Use std::fill or however that was called.
 
Can you move an object to an output stream?
 
not really
 
user1182183
@Zoidberg'-- I cpy pasted it from the pawn implementer guide
 
hmmm
 
user142019
@GamErix in that case the pawn implementer guide is terrible.
 
8:27 PM
one of my enemies in this particular game is "Johannes"
 
sbi
@JerryCoffin Then most studies must be bullshit. Most countries have stricter gun regulation laws than the US, and most countries have less causalities through guns.
 
@FredOverflow I thought the "4.0+" was pretty good too.
 
@JerryCoffin Oh yeah. Also Netscape Navigator.
 
@sbi Yeah, but there are a few like Switzerland and Israel which have equal or even higher ownership, but much lower casualties.
 
@GamErix WTF is the "pawn implementer guide"?
 
sbi
8:28 PM
@DeadMG Yes, I know those cases. That doesn't change the fact that the two generally correlate, though.
 
user142019
These crisps are the saltiest things every but oh God they are so fucking tasty.
 
user142019
@FredOverflow it tells you how to implement porn!
 
user1182183
@Zoidberg'-- yep
 
user1182183
@Zoidberg'-- striped version of C porn
 
user142019
8:29 PM
What are the advantages of Pawn over Python or Lua?
 
36 mins ago, by FredOverflow
 
user142019
@FredOverflow hmm, the quoting character (>) in the notification looks funny.
 
@FredOverflow He was trying to compile a Unix header... hahaha
 
user142019
 
sbi
> 18 dead 5-year-olds no longer have the right to bear arms. — CJ Werleman
 
8:31 PM
@Mysticial Ah come on, Unix, Windows, what's the difference?
 
@sbi Certainly wouldn't want to let facts shake your foregone conclusion, would you? In reality, most of said countries had much lower casualties before they had gun control, and imposing gun controls had essentially no effect on casualties. Just for example, Australia recently imposed tight gun controls. Gun violence has since grown at a slightly faster rate than it had been before gun control was imposed (though the acceleration is so slight it's probably noise).
 
Unix sucks and Windows doesn't
:P
 
user142019
@DeadMG it’s the other way around, silly.
 
user142019
UNIX FTW <3
 
still
 
8:32 PM
@JerryCoffin Hm, as always, I guess stricter law enforcement rarely leads to lowered crime rates.
 
time for me to return to murdering policemen and selling their weapons on the black market
 
user1182183
@Zoidberg'-- it's easy, it's kinda powerfull if you know ASM (#emit in pawn) and well, it's typeless and C-Like so it's easy to use without the need to learn too much. you could say the same about lua or python but I choose it just because it's for a "port".
 
@Zoidberg'-- All OSes suck. Some a tiny bit less than others, but the differences are pretty small.
 
user1182183
 
@DeadMG I have both Windows and Linux on my computer, so when I get pissed off at whatever OS is running right now, I can reboot and choose the other.
 
user142019
8:34 PM
@GamErix Wow, that’s really one of the ugliest pieces of code I’ve ever seen.
 
sbi
@JerryCoffin What's wrong with you, Jerry? You again come back with "anecdotal evidence". Look at this graph. You Merkins are all alone up there. So is your right to bear arms.
 
user1182183
@Zoidberg'-- somehow I prefer it over lua xD but that's personal.
 
USA isn't the only country with crazy gun people
 
@sbi "@rationalists too soon. But lulz nonetheless. - Kat"
 
They probably just have more crazy crazy people vOv
 
8:35 PM
You know, because lulz. :/
 
user142019
 
@GamErix Holy shit, that's disgusting.
 
@sbi Sorry, but the right to bear arms is not exclusive to the US, and you know it. Switzerland not only has the right to bear arms, but a duty to bear arms -- and virtually no gun violence. Correlation does not imply causation -- and here you don't even have real correlation.
 
@JerryCoffin What about the right to arm bears?
 
@FredOverflow Bears generally don't want to be armed. Their paws are much more deadly than most people's shooting anyway.
 
sbi
8:38 PM
@JerryCoffin You keep coming back with "anecdotal evidence" — something that doesn't exist. Across the western world, there's a strong negative correlation between gun control and gun violence. That there's exceptions is a given — that's why it's called a correlation.
 
user1182183
how nice to know that I have no libraries in my boost dir :/
 
user1182183
(at leat no compiled libs)
 
@GamErix well, did you build them? :p
 
user1182183
@melak47 till my last update they were always included ;o
 
user1182183
somehow when updating from 1_47 to 1_52 they dissapeared >_>
 
8:40 PM
I don't get it.. Why would you shoot kids though.
 
@GamErix you sure you didn't just download the sources?
 
@JerryCoffin Generally? You mean sometimes they do?
 
@CatPlusPlus [steamid] hockeyc
 
user1182183
@melak47 probbly
 
user1182183
well will redownload
 
8:41 PM
@GamErix 600 cpp files will now compile even slower
 
user1182183
@sehe you think I'm going to include boost into my precompiled header? no way xD
 
@sbi Well, at least you have the decency to put "anecdotal evidence" in quotes, since we both know it's nothing of the sort. The fact is that there's virtually no measurable correlation between gun regulations and violence. Canada has about the same lack of regs as the US -- but dramatically lower violence. Switzerland mandates ownership and has lower violence still. Within the US, the Dakotas (for one example) have more rifles than people -- and virtually no gun violence.
New York prohibits essentially all private gun ownership, and has dramatically higher crime rates (including gun deaths).
 
The Right to Arm Bears is a collection of Gordon R. Dickson's three science fiction novellas that occur on the planet Dilbia, where humans and an alien race known as Hemnoids are trying to win the support of the native bear-like population. Plot summary The planet Dilbia is in a vital spot for both human and Hemnoid space travel. Both are trying to convince the Dilbians to work with them to use the planet as a way station. *Spacial Delivery (Originally published in 1961) In the first story, a biologist is drafted into the diplomatic corps to aid the human ambassador to Dilbia. He sends...
 
user1182183
just in 2 files, one for the plugin loading and one for the scripts
 
@sbi +9 (last I heard)
 
8:42 PM
@netcoder Grizzly bears appear to be more open minded about it than most.
 
@Mysticial wow, that's uh, a thing
 
user1182183
those include compiled libraries?
 
@CatPlusPlus [steamid] Rapptz
 
sbi
8:44 PM
@Mysticial IIRC, Jasper Fforde also puns with this in his The Fourth Bear.
 
user1182183
where to download a package with pre compiled libs :/?
 
@GamErix 50-95MB....yeah, uh, nope :)
 
user1182183
or at least tell me which files filesystem needs and I'll add them
 
user1182183
to the project
 
user1182183
8:45 PM
@melak47 oh thx
 
@GamErix or here, has 1.52
 
Does Visual Studio have a way to add a include path to all solutions that I open/make?
 
sbi
@JerryCoffin As always, when discussing the bearing of arms with Merkins, there comes the moment where I just have to give up. I know you as a very rational and reasonable guy — yet you keep coming back with exceptions to disprove a correlation. Let's stop this right here, Jerry. There's no point in going any further.
 
@melak47 Wut:
> boost_1_52_0-vc64-bin.exe - 64 bit (AMD64/Intel EMT64), self-extracting (244MB download, 8.3GB Installed)
No shit
 
user1182183
8:46 PM
@MooingDuck just click the solution properties
 
sbi
@ScottW Adobe Acrobat?
 
user1182183
@MooingDuck you can also add them to VC directories
 
@GamErix it's irritating to have to do that for every solution I make :/
 
@ScottW win7 VM? :p
 
@GamErix move my code into Visual Studio's folders?
 
8:47 PM
Hahahaha I broke my database
 
user1182183
@MooingDuck if you open VS without a project and change in the options screen the VC directories it will be for all projects and solutions
 
sbi
@MooingDuck Yes. Somewhere under Tools/Options.
 
I've created tables in public schema
 
user1182183
@MooingDuck nono, properties > VC++ directories :D
 
And psql shows them
But public schema is empty
 
8:48 PM
@CatPlusPlus GRANTS?
 
@GamErix @MooingDuck now your ancient VS version might pay off, in recent versions there is no global vc directories property stuff anymore
 
user142019
I’m making a wallpaper. My old one sucks.
 
@GamErix per-project
 
user1182183
@melak47 >Per-user property sheets affect all projects for a particular user on a machine.
 
8:49 PM
@sbi it says "VC++ directories editing in Tools->OPtions has been deprecated" "VC++ Directories are now availably as a user property sheet added by default to all projects." (IE, solution specific AFAICT)
 
@JerryCoffin Canada gun regulations are way more strict than a majority of the states in the US
 
user1182183
but I don't know what user property sheets are
 
@MooingDuck ah, right, you have to open a project to get to the user settings
 
@sehe No, it's literally empty
 
@GamErix the options tabs
 
8:50 PM
@CatPlusPlus How can psql show them?
 
sbi
@MooingDuck Ah. I haven't done any C++ to write home about with VS since, I think, VS2005.
 
@melak47 currently using MSVC10, seems to have that limitation. :(
 
I have no idea
 
user1182183
@MooingDuck then there is a way to set the include directories for the user on the machine, at least the MS site says this :P
 
They disappeared now
 
8:50 PM
@MooingDuck yeah, nvm, do what he said
edit the platform/configuration/??? property sheets
to include your desired include dirs
should basically have 4 of them, release and debug for each 32 and 64 bit
 
@melak47 Since when should debug/release/32/64 headers differ?
 
You want one include dir and separate lib dirs for 32/64
 
@MooingDuck they're separate property sheets anyway, so idk
 
Debug builds of Boost are tagged, they don't need to be separated
(Build tagged libs scrubs)
Ahaahahahahahaha I'm terrible
I forgot to add COMMIT at the end of the script
 
user1182183
well just 20 MB, nice installer
 
user1182183
8:54 PM
I hope I can link a vc100 lib with a vc110 project ;F
 
@GamErix >_>
 
Hi All - quick question, has anyone got any experience of google-maps api (distance matrix)? I have implemented a solution using libcurl and urls - is there a better way or a better api? (is it worth asking this as a question also?)
 
@GamErix keep hoping
 
user1182183
@melak47 then recompiling will do xD
 
It's definitely not worth asking here
 
8:56 PM
:) ok
 
Unless you make it super interesting and also bribe me
 
TIL 0 isn't implicitly convertible to Long in Java
 
@MooingDuck Just put it into the include directory with Admin rights :)
 
@sbi It seems to me that the situation is a lot simpler than that: you're unwilling to admit that quite a bit of what you think you know is really just plain wrong.
 
oh sonofa... blogs.msdn.com/b/vsproject/archive/2009/07/07/… "This property sheet is actually stored in LocalAppData, just as VCComponents.dat file was, in the directory LocalAppData%\Microsoft\VisualStudio\10.0. Using the property editor on the property sheet (just right-click on this property sheet node and select Properties…), you can see that you are able to make edits directly to this file."
 
8:56 PM
@Collin stupid autoboxing
 
user1182183
yay 700 files excluding boost xD
 
@FredOverflow I'm trying to add an include directory.
 
user1182183
:/
 
Fuck property sheets, if you want it to be global, add it to INCLUDE env variable
 
user1182183
@MooingDuck or add the include path to the system PATH variable
 
8:57 PM
PATH is not used for include dirs
 
@CatPlusPlus now see, THAT'S helpful
 
There's also LIB for library dirs fyi
But get Rapid Env Editor or something, because editing env variables through Windows' system dialog will make you want to kill yourself
 
@netcoder It can initially look that way, yes. In a few ways it's even true. Much of the appearance is deceiving though -- for example, Canada has three classes of firearms: non-restricted, restricted, and prohibited. What you need to realize, however, is that "prohibited" doesn't really mean prohibited -- quite a few people (perfectly legally) own firearms that fall within the "prohibited" class.
 
@MooingDuck where's the problem? it says you are able to make changes to the file?
 
user1182183
else go play with the NTFS filesystem and link $(VCINSTDIR)include\yourincludepath to DRIVE:\your\include\path lol
 
user1182183
8:59 PM
mountpoint or sumthing
 

« first day (790 days earlier)      last day (4173 days later) »