« first day (669 days earlier)      last day (4504 days later) » 

16:00
>>= is awesome.
let file_count = getWord32le >>= \x -> fromIntegral x
amazon.de says C++ Primer was released on August 10th, and yet "it hasn't been released yet"? WTF? Similar phenomenon on amazon.co.uk with August 5th.
Maybe describe the problem, and show us the code.
Oct 14 '11 at 0:07, by R. Martinho Fernandes
(Btw, you're living in the present, trust me.)
I guess I was wrong after all.
16:02
GA registered a hit on my page with docs.scala-lang.org referrer.
user784668
@RadekSlupik (<$>) and (<*>) are awesome. (>>=) is not.
What are some good tests to write for filesystems?
What the hell.
@IDWMaster Yes.
@Fanael Totally agree.
Xeo
Xeo
Hm, seems I totally missed the actual question in that post.. "how to print all the elements"
sbi
sbi
16:02
@FredOverflow Which year? Smug look.
Xeo
Xeo
You don't even need std::rank for that
I am awesome.
@CatPlusPlus What's a yes test?
The funniest thing is, it is available on amazon.com even though it's only going to be released tomorrow :)
@Xeo Don't tell me you're suggesting going out of bounds!
Xeo
Xeo
16:03
@R.MartinhoFernandes Why?
@IDWMaster Welp, I read "are there". Anyway, look at existing FSes?
@sbi 2012. (We are living in 2012, right?)
You probably want tests that ensure integrity in corner cases.
file_count_w <- getWord32le
let file_count = fromIntegral file_count_w
Yes, that will work.
16:04
I just want a one-liner.
Xeo
Xeo
template<class T>
void print(T const& v){ std::cout << v; }
template<class T, unsigned N>
void print(T (&arr)[N]){ for(T& v : arr){ print(v); std::cout << " "; } std::cout << "\n"; }
@Xeo Getting a pointer to the first element and blasting across the entire thing as if it was one-dimensional. Hell++ just grabs a random file in your hard drive and sticks "asshole" somewhere in the middle of it.
Xeo
Xeo
@R.MartinhoFernandes ^^
16:05
@kbok Oh wait, this probably won't work.
@kbok file_count <- (liftM fromIntegral . getWord32le)
@RadekSlupik which text editor are you using again?
@CatPlusPlus Yeah, that makes more sense. Thanks
liftM is in Control.Monad.
<$> is cooler.
16:06
@bamboon on OS X TextMate and otherwise Sublime Text 2. Over SSH Emacs or nano.
What's the largest and most satisfying application have you guys written in C++?
@CatPlusPlus Why the dot ?
Composition.
@Joseph Hello, world!
@CatPlusPlus getWord32le is a monad, not a function.
16:07
Lol :P
Xeo
Xeo
@JosephPotts Not largest but most satisfying would have been the train oracle we did as an exam in our C++ course
Largest would be the Wii game
Oo, interesting.
You wrote a Wii game in C++? :P
Well I don't know what it is, where is it from?
@JosephPotts Part of an OS (user-mode)
Xeo
Xeo
Or maybe the shooter with the Unreal SDK?
16:07
@CatPlusPlus Dunno. It's clear from the example code!
(It's from Data.Binary.Get)
Xeo
Xeo
@JosephPotts Yes
@JosephPotts A FTP server.
file_count <- fromIntegral <$> getWord32le :P
Interesting
What genre was the game?
Xeo
Xeo
16:08
Puzzle
@RadekSlupik lmao
I've also written a comprehensive network security test suite which was quite large.
@ITNinja you are not LYAO.
Xeo
Xeo
@RadekSlupik The "mascot" our artist made for the game could've suggested furry porn...
@Xeo kinky.
Xeo
Xeo
16:09
It's kinda traumatic
We made so many suggestions, but it only got creepier
@JosephPotts I don't think I've yet written a C++ application :S
@RadekSlupik you got me. Im LOTI.
Xeo
Xeo
@R.MartinhoFernandes You accidentally a word.
Right now I'm trying to write a file system test suite.
16:10
@Xeo Why? There's a verb there ("'ve").
So far:
Mount tests
Seek tests
I'll see you guys later.
Xeo
Xeo
@R.MartinhoFernandes never said "verb"
Sequential I/O tests (fixed block size, variable block size, and variable and fixed number of blocks)
clang autocomplete should have a 100% correct hit rate
16:11
So far IC80FS has a 100% pass rate.
Is it bad that I code C++ like it's C?
user784668
@IDWMaster Yes.
To me it says that you're missing the point of something.
user784668
@IDWMaster If you want to write C, use C.
@IDWMaster If it works out better for you that way then that's good.
Can't imagine being more productive in C than C++ though.
Xeo
Xeo
Added actual code on how to print all elements of the array. — Xeo 54 secs ago
yay me
@R.MartinhoFernandes Europeans are strange.
> Cologne stinks to high heaven, it's a good idea
@R.MartinhoFernandes page not found :/
Ugh. Here's a great example of why I'm really annoyed with the product testing I have to do right now: The product is on version 4.0 (the release being tested). It had a 3.4, 3.5, 3.6, 3.7, all separated by a few months. So, when the test document still has "ensure 3.4 installed with option X" as part of the pre-requisite for the test, it shows how thoroughly this stuff has been tested and maintained. /raaaage.
@melak47 It's deleted.
16:39
@IDWMaster Very much so.#
@IDWMaster Yes.
@MooingDuck lol
Guys is C++ Primer 5th edition coming out tomorrow?
Oh wait, it's out! :D
Hm, I guess that means no .pdf's ... yet
16:52
Indeed, I was just about to say I'm going to wait for it
That's Primer Plus
@JosephPotts what's the difference?
ah, i see. completely different
it was also 5th edition, that confused me
16:53
:P
@BartekBanachewicz Primer Plus is crap. I have yet to find a programming-related book by Sams that isn't crap.
Do you guys think I should wait for 5th edition to come out on pdf so I can read that or should I just continue to read 4th edition
@R.MartinhoFernandes That guy must've really meant to name it that way -.-
@JosephPotts you can always buy the 5th
heh, I just got new headphones. Here's the installation instructions:
1. Turn on your computer.
2. Plug your Razer Carcharias mini-plugs into the audio ports of your computer.
16:56
I can't, I live in Pakistan =p
What does that mean?
@JosephPotts Doesn't amazon ship wordlwide?
I'm not willing to pay for the shipping cost =p
It's high.
Does this look suitable for an answer to a question?
0
A: Remove all characters of a string that are immediately followed by two vowels

ecatmurI'd suggest using std::adjacent_find: std::string s{"priamo"}; auto is_vowel = [](char c) -> bool { static const char vowels[] = "aeiou"; return std::find(std::begin(vowels), std::end(vowels), c) != std::end(vowels); }; auto it = std::adjacent_find(s.crbegin(), s.crend(), [&](...

Any suggestions for improvement?
@ecatmur tell OP to figure out what the question really is
17:04
@MooingDuck ah, but that's no fun.
-3
Q: C++ Video Game Programming IDE

user1601163Hey guys i need a c++ ide that i can actively play the game and test the updates live instead of testing it, redoing th code, compiling it and running it again, i'm running windows 7 x86 professional. and by the way(i understand that this is a big debate and stuff, thats not what im getting at th...

Do you guys think I should wait for 5th edition to come out on pdf so I can read that or should I just continue to read 4th edition
@MooingDuck That's a real comfy headset, I'm a fan. I got them as a christmas present a little while back.
@SamDeHaan yeah, but the mic doesn't work
@MooingDuck Ooh, that's a bummer.
17:09
@Prætorian it's irritating that there's so many comments saying it's impossible, when in reality, LLVM already does it.
@MooingDuck Want reopen votes so you can answer it and get loads of lolrep?
@MooingDuck Didn't know LLVM could do that! Want me to cast reopen vote?
@SamDeHaan I voted to reopen, but I don't know enough to answer
@Prætorian it has a C++ JIT, but I have no idea how powerful it is nor how to use it. But even if it can't do what the OP wants, the answer is "no current thing does that". There's no reason for the question to be closed.
@Prætorian ITT nobody knows what they're talking about.
I know how to use it from Haskell. It's really nice.
17:13
There's also code.google.com/p/asmjit for doing C++ JIT (No exceptions and RTTI.)
He got my upvote since SO just reminded me a few minutes ago that I haven't voted on questions in a while
Actually... MSVC can JIT C++/CLI!
No, you don't have a compiler API.
It can only JIT IL.
Maybe you can do it using the open-source "C++/CLI with extensions" compiler (yes, there is such a... thing).
17:16
Also runtimecompiledcplusplus.blogspot.co.uk looks interesting and quite active.
@Cheersandhth.-Alf I can't make sense of what's happening there?
Erm, isn't that thing just running inside the VS debugger?
What am I missing?
Ok, C++11 has error categories. Yet another thing that I was completely unaware of. It just keeps coming :D
I have no idea how to use that part of the standard library.
Ell
Ell
@StackedCrooked error categories? o.O
@ecatmur Apparently that uses CreateProcess to launch cl.
Truly a masterpiece.
Or maybe not. WinAPI code is confusing.
	std::string cmdToSend = "cl " + flags + pCharTypeFlags
		+ " /MP /Fo\"" + intermediate + "\\\\\" "
		+ "/D WIN32 /EHa /Fe" + outputFile.string();
Ok, definitely launches cl.
Also...
It apparently depends on the DirectX SDK.
user784668
Boost.ProgramOptions y u dont round floats
I hope that is due to them being silly and forgetting to mention the DirectX is only needed for the demo.
@ecatmur Ah.
> Additionally, although we've only implemented the compiler interface for Visual Studio at the moment, the method relies on standard C++ so can be ported to other platforms.
AFAIK, LoadLibrary is not standard C++.
user784668
--mutation-rate arg (=0.10000000000000001)
user784668
Really?
1 hour ago, by FredOverflow
The funniest thing is, it is available on amazon.com even though it's only going to be released tomorrow :)
user784668
17:26
Is there any way I can make Boost.ProgramOptions print the default value as 0.1?
@MooingDuck can't VS do Edit&Continue?
user784668
Oh wait.
@R.MartinhoFernandes sometimes
@R.MartinhoFernandes don't I feel silly
17:29
That's just usual IEEE float nonsense, isn't it
user784668
I can pass a string that will be shown instead of that as the second argument to default_value.
user784668
But default_option(0.1, "0.1") isn't exactly pretty either.
@MooingDuck FWIW, you can't Edit&Continue in C++/CLI (how the fuck does that make sense?), so I doubt the claim that VS can JIT C++/CLI.
@R.MartinhoFernandes en.wikipedia.org/wiki/Common_Intermediate_Language "Upon execution of a CLI assembly, its code is passed through the runtime's JIT compiler to generate native code. Ahead-of-time compilation may also be used, which eliminates this step, but at the cost of executable file portability."
@MooingDuck That's upon execution of already compiled code.
The C++/CLI is already compiled at that time, and only IL is jitted.
17:32
@R.MartinhoFernandes doesn't that also apply to Java? I thought bytecode still counted as JIT
@MooingDuck Yes, but it's jitting bytecode, not Java.
@R.MartinhoFernandes hmm true
With libclang and LLVM you can indeed JIT-compile C++. But not with just the CLR: you need the C++/CLI compiler at runtime.
@R.MartinhoFernandes edited my answer with that info
user784668
How can I test if a number is NaN?
17:40
97
Q: Checking if a double (or float) is nan in C++

hasen jis there an isnan() function? p.s. I'm in mingw (if that makes a difference) UPDATE Thanks for the responses I had this solved by using isnan() form <math.h>, which doesn't exist in <cmath>, which I was #includeing at first.

Would this actually work?
0
A: C++ - Create polymorphic object on stack?

PrætorianA combination of a char array and placement new would work. char buf[<size big enough to hold largest derived type>]; A *a = NULL; switch (some_var) { case 1: a = new(buf) A; break; case 2: a = new(buf) B; break; default: a = new(buf) C; break; } // do stuff with ...

@Prætorian if you're very very very careful, yes
@Prætorian also see: boost::variant, which does the exact same thing, but safely
@MooingDuck You should post that
@Prætorian I was about to answer something with boost::variant, which may use a similar approach.
@Prætorian a non-boost variant that's still much safer is a pool allocator.
17:43
@R.MartinhoFernandes The guy who's answer you commented on didn't appreciate it very much
> (EDITED, for the sake of commentors who really need it spelled out for them.)
@Prætorian I just commented again :)
That answer went from "not answering the question" to "just wrong".
@R.MartinhoFernandes STOP COMMENTING FASTER THAN I DO :(
Ell
Ell
18:02
aghh I'm bored out of my minddd ahhhh
I almost got bored playing Solitaire, but I knocked it up a notch: now I'm playing left handed while eating semolina with my right hand and watching Beavis and Butthead simultaneously. My record is currently 2:44.
@MooingDuck Actually, he's right.
That last paragraph is the best solution in the whole page (see Mike Seymour's answer for a code example).
@Ell How about playing Solitaire left-handed?
Ell
Ell
naaah I'm continuing with my pokédex web crawler now :D
18:09
@R.MartinhoFernandes oh, I get it now
I'm also downvoting any answer that assumes alignment doesn't exist.
We don't live in "x86 everywhere"-world.
@R.MartinhoFernandes I don't think it works on x86 either
@MooingDuck Unless it's SSE stuffs, it gets slow as heck but "works".
@R.MartinhoFernandes does it?
@MooingDuck yes
18:13
not necessarily, turns out this crash was due to an SSE alignment issue:
6
Q: What would cause _mm_setzero_si128() to SIGSEGV?

FredOverflow Possible Duplicate: Qt, GCC, SSE and stack alignment I am converting a simulator from TinyPTC to WxWidgets. Some graphics routines are optimized with SSE intrinsics. During the initialization of the GUI, the initial state is rendered once, and all of the SSE routines work perfectly. Ho...

posted on August 15, 2012 by Rahul V. Patil

If you have read Jason Zander’s post earlier today, you know that Visual Studio 2012 has been released to the web! Check out the MSDN Subscriber Download Page  and the Visual Studio product website. This release has brought a huge amount of new value for C++ developers. Here are the highlights:    C++11 Standards Support Language Support Range-based for loops. Yo

To some extent the newer processes are optimized well to handle it. But you'll run into memory throughput problems.
@FredOverflow I explicitly excluded SSE in my assertion.
@R.MartinhoFernandes stupid me :(
On Sandy bridge and later, IIRC, a misaligned load has the same latency as an aligned one. But it hogs two memory banks instead of one.
So yes, that one misaligned access is fast. But it'll block other accesses that would otherwise run on the same cycle(s).
18:15
other than the solutions mentioned you can try using directives ifdef and define — Moataz Elmasry 36 mins ago
lol
@Mysticial One thing I always wondered: is there any technical reasons why the x86 became so popular? Because I think the x86 instruction set is a complete mess.
@FredOverflow Not really. Just being in the right place at the right time, so to speak
@FredOverflow I think x86 started off as a very simple to implement architecture.
If you go all the way back, the original x86 is nice.
@FredOverflow Maybe it became a mess after becoming popular?
18:23
The x87 FPU is very nice to implement in silicon.
@R.MartinhoFernandes So x86 suffered the fate of every rock band? :)
@Mysticial How so? It's CISC, variable instruction lengths, all sorts of complicated instructions
@FredOverflow lol, I was just thinking that.
@jalf Wasn't it fixed instruction length to start with?
@Mysticial but that came much later
18:23
1 byte opcodes
@Mysticial Was it? I don't know :)
@R.MartinhoFernandes x86 sold out and betrayed its fans!
2
When they ran out of opcodes, the threw out one instruction and used it's 0F opcode as an escape code for new instructions.
anyway, I don't think the "implementation niceness" really matters since Intel were the only ones implementing it early on
@Mysticial What instruction was that?
18:24
That's where the variable length instruction mess came in.
@FredOverflow dunno, look it up. But it was basically useless.
NOP is 90
well
NOP is EA on 6502, which always reminded me of Electronic Arts.
18:26
I get why x86 is full of ugly now
@FredOverflow I wonder why.
but I don't know why they didn't change that for x64
Once you try to do superscalar OOE on x86 is when it becomes nasty as fuck.
Anyway, the early x86 cpus were cheap, and together with dos and bios made for a pretty strong platform
so with visual studio 2012 out, how long do you think before it hits MSDN AA / Dreamspark?
18:27
I think the biggest factor was just that synergy
@jalf synergy, argh
x86 doesn't work well with register files. Register files are expensive to implement in silicon. So it probably didn't exist back then.
@FredOverflow en.wikipedia.org/wiki/X86_instruction_listings "POP Pop data from stack POP CS (opcode 0x0F) works only on 8086/8088. Later CPUs use 0x0F as a prefix for newer instructions. 0x0F"
@melak47 Is it out already?
@R.MartinhoFernandes the news feed thing just said it was :p
@Feeds here
ah, vs11 is out
it's vs12 now :)
No, it's VS11.
no, the version number is 11
VS10 was just an unlucky coincidence.
18:30
the year (which is part of the product name) is 2012
@melak47 it's a version, not a year
should be interesting to see their much vaunted promise to update after release
a'ight, VS'12 then :p
@melak47 VS8 came out in 2005
18:30
MSVC/VC++11
hey, VC++11 has C++11 features, what a neat coincidence :p
May 6 at 21:29, by R. Martinho Fernandes
@dreamlax On a scale of C++03 to C++11, I'd say it's about C++06 or C++07.
yeeeah, of course, it'd be a bigger coincidence if it actually added new C++11 features ;)
yeah, I wish it had initializer lists :(
so yeah. whatever happened to MSDN AA? or is it all dreamspark now? or was it just my university that switched to dreamspark?
@melak47 I think it's dreamspark
18:33
@melak47 VC++10 had C++11 features too. In fact, so did VC++7
ours switched too
my old login still works though
@R.MartinhoFernandes You're the Chat Search Master.
@jalf yeah login stayed the same for me as well
@EtiennedeMartel And chat search sucks.
Is it some onthehub.com thing?
I was expecting at least some microsoft.com in the domain.
so, do I have to wait for my university to put VS2012 in the lineup, or will I get it automagically? :p
@R.MartinhoFernandes yes
incredibly slow for me right now.
guess everyone's downloading VS?
18:35
Yeah, taking ages.
just timed out on me trying to open m "profile" thingy
On a different note, I finally received my inflatable Balloonicorn!
@melak47 I'm still waiting for the login page to load.
I wish X-Lite wouldn't change the system volume when it starts/stops. :/
@R.MartinhoFernandes :s neat
18:38
@MooingDuck WTF kind of application is that?
If you want to play stuff louder play louder stuff. Don't fuck with my system settings.
@R.MartinhoFernandes it's a telephone on the computer.
@R.MartinhoFernandes srsly
@melak47 At least under msdnaa, I believe your university's msdnaa administrator had to add new products. Not sure how it works under dreamspark
@jalf hmm, well the windows 8 release candidates showed up in there, so I figure it is kind of automated
alright...there is a visual studio 2012 entry...let's see if it's the beta/RC..
18:40
@melak47 mine shows RC
mine isn't loading yet :p
lost my wallet :(
@MooingDuck what kind of dreamspark membership thingy do you have
@DeadMG Damn.
@melak47 I haven't the foggiest idea, I typed in my email and it showed me programs. So I presume my school has some sort of account.
18:42
@MooingDuck mine says "premium" at the top. whatever that means
yup, just the RC.
@melak47 I checked, the dreamspark front pages shows VS11 RC, even when not logged in
well, the RC still has 152 days before it expires.
what's the situation with Win RT anyway, I hear it does come with desktop afterall? so can I (ideally) just target ARM and run my regular C++ desktop apps on it?
hmm, or I could download the 90 day trial and hope I get a license before it runs out :p
iirc, it comes with its own crippled desktop which is only usable by select Microsoft applications
(read: the ones Microsoft were too lazy to port to be usable with touch)
yeah, office, and something.
IE, I think
but afaik, it's not accessible to third-party apps
so pretty much worst of both worlds, IMO
you get to drag around all the backwards-compatiblity cruft, but you can't use it
18:57
whee! The checked in code crashes only on my machine and only if I'm debugging! (I hate Java)
@jalf so, if I compile say a console app for ARM, put it on a Win RT device, and open it from the desktop...it won't work?
so there's like a 0 chance win RT devices will be useful for anything? not even pulling .raw images from a camera because you can't install anything that'll view them?
-1
Q: reinterpret_cast, casting to brother class

gena2xI am just wondering if the following C++ code guaranteed to work: struct B1 { virtual void f() {}; }; struct B2 { virtual void f2() {}; }; struct D:public B1,public B2 { }; int main() { D d; B1 *b1=&d; if (dynamic_cast<B2*>(b1)) { B2* b2 = reinterpret_cast&...

Sometimes I wish reinterpret_cast didn't exist.
Well, either that, or that people weren't downright stupid.
"brother class", eh?
lol, I see that @jalf discovered SCARY iterators.
IDK why that's being downvoted...
19:07
Do you guys think I should wait for C++ Primer 5th edition to come out on pdf or should I just go on and read C++ Primer 4th edition (complete beginner to C++)?
@JosephPotts just read this :p
That's C.
have anybody been into such problem before ? I was using VS2010 working for several days using wchar_t and there was no compiler error no crash. But there as string+ wstring and cout << wstring operation. though there was no error . today suddenly I strated getting all those errors ?
@JosephPotts I'd wait
19:10
@NeelBasu nope, you should have always been getting errors.
@LuchianGrigore I downvoted because it shows no research effort (there are about 12.3 gazillion dupes and answers that explain it on SO, nevermind Google); because it makes no sense, the code at the end doesn't even compile; because if the code at the end compiled it wouldn't even do anything.
@MooingDuck I am still wondering in git that my previous commits were using wchar_t and had all these problems that causes errors but it compiled then. but right now even If I pull then and recompile it doesn't work
@NeelBasu cout << wstring() shouldn't work. Can't send a wide string to a narrow stream.
@MooingDuck then did the compiler missed the header file yesterday ?
I meant Is it possible with VS ?
@NeelBasu I dunno.
@NeelBasu nope, VS never would have compiled anything like that, unless it was using some conversion constructor. (which would have been a bug in your code)
19:14
I donno I should have seen those errors earlier. now It got all messed up
19:28
@EtiennedeMartel Found it. Twas under me pillow, bruv.
@DeadMG Wait, you hide your wallet under your pillow?
not intentionally.
else I'd have been able to find it when I was looking for it
Ell
Ell
@DeadMG hows sha solver?
@DeadMG That makes sense.
Ell
Ell
19:37
also what does it do? Find some plain text with a given sha hash?
@Ell It's one of those annoying times when I have only a relatively vague idea of how to proceed
@Ell When it's done.
@Ell There are basically two types of attacks on hashes. One finds an input that will produce a specific output. Another just finds two separate inputs that produce the same (but previously unknown) output. The first (aka, a preimage attack) is usually much more difficult than the second (a collision attack).
Ell
Ell
Right okay, that makes sense
Going back to an earlier conversation where Fred asked about the popularity of x86: in fact, Intel was specifically designing the x86 to be crappy. At the time, they were designing the iAPX432, to be the "good" processor, and the x86 specifically as a stopgap until the 432 was ready, but crappy enough to keep it from becoming too popular, so when the 432 was ready, it would dominate. In this they failed in exactly the way they'd foreseen. When the 432 came out, if flopped and the x86 remained.
hmm
what's ?
19:46
not safe for lunch
not safe for lunch
@JosephPotts depends on your compiler and your goals
@JerryCoffin why did the 432 flop?
presumably because it wasn't backwards-compatible with the x86
so why didn't they make x86 less crap after that :p
out of spite?
19:51
mostly because, again, backwards compatibility
@melak47 IMO, large because it was too ambitious. It was late being released, slow, expensive, and at least initially had quite a few bugs. On top of being expensive itself, it was expensive to design for too -- it was so large it lived on three chips, with some fast busses between them, so designing a motherboard for it was non-trivial.
@melak47 They have, at least sort of. As of the 386, they added larger address space, paging, etc. With x64, AMD cleaned up quite a few parts too. Intel would really prefer to get rid of x86 completely though. The i860 and Itanium were both originally intended to replace it, but neither has gotten very far. Despite the crappy programming model, x86 is (more than) good enough for most consumers, so changing (especially to anything more expensive) is hard to sell.

« first day (669 days earlier)      last day (4504 days later) »