« first day (1061 days earlier)      last day (3878 days later) » 

12:00 AM
@ripDaddy69 A book about patience, I think he means.
 
@Rapptz I'll try it
 
Smallest tick is nanoseconds I think
 
@MooingDuck s/may or may return/may or may not return/
 
@Rapptz clock_t is easier to remember than std::chrono::time_point<std::chrono::system_clock>
 
user1174868
 
user1174868
12:00 AM
What is wrong with that?
 
@MooingDuck um.. auto.. and std::chrono::high_resolution_clock.
 
@ripDaddy69 What are you trying to do?
 
(You might be too used to C++03, I don't know)
 
user1174868
@Code-Guru 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
 
@ripDaddy69 Besides the terrible indentation scheme?
 
user1174868
12:01 AM
I thought I fixed it
 
user1174868
everyone likes something different for code formatting
 
user1174868
can never please everyone
 
holy fuck those braces
 
user1174868
oh pastebin messed it up a little bit
 
@ripDaddy69 yah, you need to learn to use your debugger.
@ripDaddy69 use spaces not tabs
 
user1174868
12:02 AM
?
 
@ripDaddy69 There's a difference between using a different code formatting scheme that I don't prefer but makes sense, and using a code formatting scheme that makes zero sense whatsoever (although in this case it's probably not your fault since it's in a pastebin)
 
8
A: Timing algorithm: clock() vs time() in C++

Rapptz<chrono> would be a better library if you're using C++11. #include <iostream> #include <chrono> #include <thread> void f() { std::this_thread::sleep_for(std::chrono::seconds(1)); } int main() { auto t1 = std::chrono::high_resolution_clock::now(); f(); auto t2 = std::chrono::hig...

 
user1174868
I tab out all my braces to match and I tab in for each loop or if statement
 
@ripDaddy69 anyway...you might want to look into prime factorization and factorials.
 
user1174868
12:04 AM
@Code-Guru Why? Is that is what is causing my code to crash?
 
@MooingDuck lol. "meaningful" :/
 
duration_cast!
 
I'm curious about something: I've seen lots of static const std::string s = "Hello World!"; defined in global scope in other people's code. Almost certainly the constructor for s will call dynamic memory allocation routines to store the string. Does the runtime use compiler/platform-specific magic to make sure all the runtime stuff is initialized before all the static objects or what?
 
@sehe the assembly gives the current tick count of the cpu executing the thread. If an interrupt happens, or it switches to a different cpu, the assembly timings become meaningless.
 
I thought that could only happen if there was a bug in the BIOS or OS
@Insilico Yes, the compiler is obliged to call constructors for complex global objects.
 
12:08 AM
 
@MooingDuck I didn't mind
 
ah, rdtsc directly, I thought you were referring to QueryPerformanceCounter
 
@DeadMG Yes, I know for a fact that compilers will call constructors for global objects. But say that a user-defined global object calls some kind of runtime function directly or indirectly e.g. std::cout or new. Does the standard guarantee that this will always work?
 
yep.
for std::cout and friends, it even provides guarantees that std::cout is initialized before user-defined globals.
or maybe that it certainly will be if you call a special function first? don't entirely recall.
 
user1174868
oh cool
 
12:12 AM
I wonder how that works without running into the static initialization order fiasco. I presume that this depends on compiler and/or platform-specific magic or something.
 
user1174868
the debugger was sort of useful
 
anyway, I'm pretty sure it's illegal for Standard functionality to not be enabled.
 
Either way, it would certainly be counterintuitive.
 
@DeadMG Interesting. I'm trying to come up with a situation where that mechanism will fail, but I'm coming up with a blank.
 
12:15 AM
@Insilico The most obvious is where the user did not remember to use it or know that it was required.
 
damn Windows..
 
1
Q: Order of initialization

ChethanMy question pertains to the order of initialization of global objects. It is discussed to some extent here: C++: When (and how) are C++ Global Static Constructors Called? What I would like to know is, how is it guaranteed that some system library objects (can't think of an example though) are in...

 
@DeadMG I'm not certain users have to do anything, I think it's some trick that forces the initialization of the streams right away. Though I'm not sure how such a thing would work.
 
Looks like my question has already been answered (figured as much).
 
@MooingDuck The user has to construct an instance of that type in order to receive the guarantee.
 
12:17 AM
@DeadMG oh
 
@MooingDuck Apparently another way is to simply include iostream before you use any of its objects. The magic initializer object gets constructed in each translation unit that includes iostream.
 
The "Vsync" option in amnesia doesnt actually vsync >.>
 
(if I'm understanding this correctly)
 
@Insilico If that were true, there would be no need to expose this type to the user.
 
@Insilico that was my understanding as well
 
12:20 AM
@DeadMG If it's so important to construct it to ensure everything gets init'ed before I use cout, why haven't I heard of it until now? You'd think the docs would include something like "You must construct a ios_base::Init` object before you use cout and friends."
 
@Insilico Because SIOF only occurs if you're stupid enough to use global variables that print to std::cout in their constructors.
 
user1174868
SIOF?
 
@ripDaddy69 Static initialization order fiasco
@DeadMG True, but what about my prior example with global std::strings calling standard library functions e.g. allocating memory? Would you also consider that to be "don't do that unless you're an idiot" scenario?
 
nope
pretty much the only stdlib functionality that is provided through a global variable is std::cout.
 
How does something like malloc and new work in the constructors of non-local static objects then?
 
12:24 AM
they call the function.
how else does it work?
 
@DeadMG So the heap is lazily initialized?
 
who says it requires initialization at all?
the heap is an OS facility, really.
it's the OS's job to make it available to user code.
the details are irrelevant; because the OS API is clearly not a C++ static object and therefore cannot fall under SIOF
 
@DeadMG coliru.stacked-crooked.com/a/05123ec7f350227f wouldn't this be a workaround?
 
@MooingDuck The workaround is not to be fucking stupid and don't make globals that print in their constructors.
 
@DeadMG or design a class that isn't stupid and doesn't have stupid errors like SIOF
 
12:28 AM
@DeadMG I would agree, except that there are people who use non-system allocators like tcmalloc and jemalloc, et al. and they seem to work just fine in non-local static constructors.
 
well, I gotta admit that if you're running into SIOF then you are almost certainly doing it wrong.
@Insilico At the most fundamental level, they are just wrappers on the OS allocators.
 
So I wonder if they're using platform-specific magic to make sure it's "all wired up" correctly before first use even in a SIOF.
 
@DeadMG no, I mean, for a well implemented library, then even a stupid user cannot run into the SIOF with library globals.
 
@Insilico Those APIs don't involve C++ globals. How could they possibly run into SIOF?
 
@Insilico don't need platform specific magic, you can do it in the base language
 
12:29 AM
@DeadMG How else do you maintain the heap state like free lists and stuff without using globals?
 
@Insilico operating system
 
well, firstly, they could well use function-local globals and that sort of thing that do not suffer from SIOF
and considering that they're a C API and therefore suffering from SIOF is physically impossible
I'm going to venture that "Who cares because they clearly found a way" is going to be the answer here
 
@MooingDuck I'm talking about non-system allocators (e.g. jemalloc, tcmalloc which Google and Mozilla seem to be fond of)
 
@Insilico either globals or function statics. (what was the origional question?)
 
The original question was how do standard facilities that require some kind of global state to be maintained e.g. cout and some implementations of new make sure all that stuff is initialized before they're used in non-local static constructors in the face of SIOF.
(Most likely a stupid question since who the hell cares how it works)
I honestly think it requires compiler-specific magic but I wonder if that's actually the case.
 
12:35 AM
@Insilico function statics
 
@MooingDuck Is it really that simple? I feel like an idiot.
(Then again I rarely use function statics so of course I wouldn't think of them)
 
@Insilico yes. It's talked about on virtually every page that talks about the SIOF
8 mins ago, by DeadMG
well, firstly, they could well use function-local globals and that sort of thing that do not suffer from SIOF
 
@MooingDuck You know I just now realized the oxymoron of "function-local globals".
 
well that's what you get for associating scopes with lifetimes
 
Hm.. I can't think of a way to turn .\dir\stuff.txt into dir\stuff.txt in Boost.FileSystem. I thought using begin() and incrementing by one would work but I guess it rarely works.
 
12:52 AM
GAH! Some 3rd party program on my computer keeps attaching to my program and then doing access violations and null pointer dereferences all over the place!
dropbox is the worst, but some Microsoft dll and some apple dll are in there as well, as well as tortisegit and something else.
 
@MooingDuck How'd you figure that?
 
@Insilico Windows equivalent of valgrind
 
user425495
I'm still hoping to get some more discussion on this
 
user425495
5
Q: Shared pointer to an immutable type has value semantics

justinlsSean Parent gave a talk at Going Native 2013 titled Inheritance Is The Base Class of Evil. At 20 minutes, 50 seconds in, he makes the statement that a shared pointer to an immutable (const) type (std::shared_pointer<const T>) has value semantics. What exactly does this mean? Why is it any differe...

 
1:29 AM
Whoa, nuwen distro doesn't have std::to_string
 
1:41 AM
it's gcc/libstdc++ prolly 4.7?
 
Oh I'm using STL's 4.8.1 version.
 
1:55 AM
Anybody want to help me with some simple math?
 
Evening
 
Evening.
Wait, isn't it like... late for you?
 
So, I'm starting to appreciate C++. Maybe I have brain tumor or something.
4am here.
 
Does this have a central time that you say evening?
Though I guess night is never really used as a hello. Hrm.
 
^
 
1:58 AM
Want to help with some simple math?
 
Uhm. Depends.
 
I suppose I should figure out if the math is buggy before I fix it. If it is needed at all.
 
Am I the only one thinking that using dynamic_cast means that you are doing something wrong?
My professor is all about "If you are not using dynamic_cast for every polymorphic pointer you got then I'll just give you an F".
 
I don't think I can really answer that, because I suck at polymorphism implementation and have never used it. I am curious though, because your teacher sounds kind of...extreme.
 
@EtiennedeMartel I just read the article you sent me. Even though I'm tired of this meme.... Bracer yourselves, a shitstorm is coming
 
2:06 AM
has anyone seen the phoneblocks thingy ?
@Pawnguy7 what kind of math?
@Jefffrey depends on the cast :P, but it might be the portable way to do it, I dunno. Just do it so you can pass
 
@A.H. Basic algebra probably.
 
what is it ?
but no promises its 4:15 AM, and I haven't slept yet
 
That's fine. Anyway, you are familiar with the screensaver?
 
I remember you were making a screen saver
 
@A.H. Hmm. Looks like a good idea. I don't know how much is it technically possible though.
 
2:17 AM
Ok. So, it is made of blocks. Anyway, I wanted to not make draw calls that you are never going to see.
Which, I thought worked fine. However, the screensaver doesn't run for somebody else. My best guess is it had something to do with the screen size, so I was looking here. If the calculation is off, it might make an out of bounds call.
 
@Jefffrey I think the features as described are not all possible, to some extent PCs are modular but you can't plug a PCI card anywhere , nor attach any processor to any chipset.
@Pawnguy7 you mean it didn't work on another computer but the release version worked on your machine ?
 
@A.H. Yes. I don't believe it is undefined behavior, however. A problem with my calculation, on the other hand, I find likely: it had been broken previously.
 
It's UB.
 
what do you mean by draw calls that you are never going to see ? (also am I correct to assume this is windows? )
like outside of the client area?
 
For example, the world is 100 by 20 blocks. By it only shows 40 blocks wide at once. Yes, this is windows.
@Rapptz Quite likely in larger projects, but I am doubtful here.
 
2:23 AM
and that is the expected behavior ?
 
@Pawnguy7 99.99% certain it is.
 
@Rapptz what exactly do you think is UB ?
 
@A.H. Showing 40 blocks? Yes. It scrolls.
 
The fact it runs fine on one machine but not the other is definitely UB.
 
oh yeah 100%
 
2:25 AM
What if it uses machine specific information (screen size) and calculates incorrectly?
 
test with different screen size then
try to replicate client's screen size
 
Not sure why I didn't think of that. I will do that straightaway.
 
if you can't reproduce it , you can't solve it
 
Reproduced.
Ahah. The bug seems to be where I thought it was.
 
@Pawnguy7 Good developers don't do UB and know how to avoid it.
 
2:33 AM
When I have UB, it is so blatantly wrong that it crashes everywhere :D anyway, looks like UB wasn't the fault here.
 
@Pawnguy7 what was it ?
 
@Pawnguy7 Memory access violations which are very common is already UB.
 
@A.H. Seems to be my culling calculations.
@MarkGarcia I suppose, technically, it would have lead to that, but instead bounds were checked, and a exception was thrown. Though in this case, while the end result would indeed be that, it was caused by the math. If it makes a difference.
 
2:58 AM
I'm officially nuts now:
0
A: Too many sections, assembler error, using boost::spirit

seheI've done some hacking here and refactored things a to show the non-runtime-polymorphic style: https://bitbucket.org/sehe/joos2compiler-refactor (based on your 12d01e5 commit). I hope it doesn't increase compile times :) (I haven't actually come round to splitting the grammar up, but it got ...

Time for bed :/ Cheers
 
Good night.
 
user1174868
thanks for the help everyone, night
 
Rest in peace. :)
 
3:28 AM
Are there any compilers that support std::optional out there?
 
No.
Use boost's or make your own. It's easy anyway
 
Other than wrapping a pointer, not sure how I'd implement it :p
 
@MohammadAliBaydoun Copy Boost's. :)
 
I can use Boost's, but I'm only doing this for a quick proof of concept
Guess it's about time to get my shit configured correctly so I can use Boost when compiling with gcc from commandline :/
 
3:43 AM
Yay, it works C:
 
@MohammadAliBaydoun Aligned storage and placement new.
It does not wrap a pointer.
 
> Dear Google APIs User,
>
> You deleted the project “API Project” on Jun 26, 2013 6:22 AM. If you still want to delete this project, you don’t need to do anything. The Google APIs team will remove your project permanently one week from the time of your request.
>
> If this project shouldn’t be deleted, you must visit the following URL before Sep 17, 2013 4:35 PM.
Google is not very good at calendars.
 
But you could make a simplified optional<T> yourself if you require T to be default-constructible.
@CatPlusPlus Summer vacation :)
Wait that would be a very long vacation.
 
Okay, what the hell. G++ is compiling random trash files :|
 
@StackedCrooked You can make one by wrapping one though.
 
3:55 AM
@CatPlusPlus I didn't know you made the API project. I use APIs a lot, so I guess I owe you thanks for that.
 
And all this time I thought my template magic compiled ;_;
 
TBH I don't know why optional<T> is done via placement new but whatever
 
@StackedCrooked I only make good APIs, so not the Google one, no.
 
@CatPlusPlus Do LoungeCPP members have push access to the repos, or do we still need to fork them?
 
@Rapptz: As opposed to allocating an object, it uses less memory.
 
3:59 AM
Wow -- we're still in gallery mode? Has the snake troll been back, or did it just stay by accident?
 
@Rapptz Maybe to be able to place the object in the stack.
 
@Rapptz: Allocating on the heap, that is.
 
@JerryCoffin not in gallery mode
 
@A.H. Oh, okay -- somehow I just saw a request for access...
:11716740 As in posting requires approval.
 
@MarkGarcia Forks.
 
4:01 AM
Oh. The chat mode.
 
if we were wouldn't there be a lock near the name ?
 
@MarkGarcia I like your idea of gallery mode.
 
@Rapptz: Would also be much faster if it wasn't null.
 
@StackedCrooked Thanks. I just don't know much about chat admin thingies. :P
 
@VaughnCato No, it doesn't.
 
4:02 AM
@JerryCoffin actually he came back , and I think he was way nicer
 
How the fuck would that make sense.
 
Yeah I'm confused
 
@CatPlusPlus Thanks. And that would be cleaner than direct push access.
 
@CatPlusPlus: how would it make sense to use placement new instead of allocating on the heap?
 
@CatPlusPlus possible that heap new would allocate more than it needs to reduce num of syscalls. Also possible that new would require meta-data to manage the heap. Fuck it , it makes no sense
 
4:02 AM
@MarkGarcia Not sure why they called it "gallery mode".
 
@StackedCrooked look but don't touch ?
 
That's far fetched imo.
 
@MarkGarcia You'd all break it.
Also, it is 6AM.
Why is it 6AM?
 
in galleries you get to watch ?
maybe because you are in the UTC + 2 timezone
 
@StackedCrooked Missed opportunity for calling it the porn mode.
 
4:05 AM
@CatPlusPlus Because of where you are. Here it's only 11 PM (in Texas at the moment).
 
Wars in Civ5 take so damn long.
 
lol
that explains why it's 6 AM.
 
We've started playing at like 10PM.
 
standard pace?
 
Yes. Third day in a row all night long.
23.4 hours.
Total.
 
4:09 AM
@CatPlusPlus But very fun especially in the late game.
 
Steamrollin' AI with giant robots.
 
But I hate it when the wars end.
 
Set the world on fire~
Literally.
 
Too messy and too much work afterwards.
 
Roll through and burn the earth.
 
4:12 AM
@JerryCoffin As you might already know, Zamboanga's in terror right now. Though the situation is relatively calmer than yesterday's.
 
nukes
also I wish you could disable the robots
 
 
Did we go into gallery mode or something?
> Vaughn Cato has requested access to...
^^ ahahaha
 
4:29 AM
 
@StackedCrooked not what I expected
 
@Mysticial Screenie?
 
@Mysticial classy :P
 
@Mysticial lol thanks!
 
4:35 AM
> LPT: Keep your roll of trash bags at the bottom of your bin. As you take a full bag out, a fresh bag is right there to put on.
lol, I don't have a bin
 
@MarkGarcia Yeah -- I've been in touch with my wife. From the sounds of things, her family's pretty much out of the line of fire, at least for now. Not sure how long that'll last though -- her mom (especially) is apparently being a bit stubborn about things, and (so far) has insisted on staying.
 
std::function invocation makes my stack trace messy
 
@JerryCoffin Not so much to worry about now, as the rebel troops have been releasing some of the hostages and declaring ceasefires.
 
4:41 AM
@Mysticial nice
 
import nohomo must work.
 
5:10 AM
^ Wow
 
Happens in Lebanon quite a lot too~
 
5:52 AM
Went to this Chinese supermarket, always meet the rudest shop assistants/cashout chicks there ...
 
@Telkitty猫咪咪 The chicks are very lewd? Cleanup in aisle 4.
 
OMG potato waffle long time no see
 
When people say "Using scanf isn't safe for use in the real world", what do people use then? (C question)
 
@Rapptz scanf
 
@Rapptz sscanf isn't safe. IIRC the string could lack termination? I don't even recall. Anyway I don't remember hearing a complaint about scanf.
 
5:56 AM
@Rapptz As do when people say "Don't do unprotected sex as it is not safe to do.", and people still do it.
 
Blizzard used sscanf in Warcraft III quite a lot. Because of this, we have the ability to get some useful metadata in the DisplayTimedTextFromPlayer JASS function :P
 
@MarkGarcia lol
Some say cow's milk is not good for us because it was not "intended" for human consumption (but for the calf).
 
Good morning
 
I think by the same reasoning you could say apples are bad because they were not intended to be eaten by humans.
@sehe morning
 
6:09 AM
Good morning.
 
(Might need Google Translate.)
 
Did /r/programming go full retard? What's with this?
 
@Rapptz I don't see the "full retard" part. (Then again I TLDR'ed the thread)
 
@Insilico They've been riding this infected compiler thing for a few days now. It's kinda like fearmongering.
 
user1804599
@StackedCrooked Dat is toevallig.
 
6:21 AM
@Rapptz AFAIK, they haven't made a big issue like that for malware.
Only now that there's this NSA security stuff.
 
user1804599
%!xxd, edit, %!xxd -r is cool.
 
Ell
Are they suggesting compilers insert backdoors into their programmes somehow?
Trust attack
 
Ask a dumb question about compiler backdoors and link it on r/programming. You might get a gazillion upboats.
 
6:47 AM
OK, I've moved to Lanzarote and the rest of the Lounge has moved to the west coast? I'll have to catch up with yesterday's posts/events! Later - I'm a bit beerpocalypsed ATM.
 
@Rapptz so how did that go? I ended up pulling a classic one myself. Already waking my way back home from dropping the kids off for school.
 
I actually didn't nap/sleep when I came home and wasn't tired.
I was going to but the smell of food woke me up.
 
And the OP likely didn't even notice I refuctored his Java parser (spirit, obviously)
Har har Mobile be clumsy as ever :(
 

« first day (1061 days earlier)      last day (3878 days later) »