« first day (305 days earlier)      last day (4657 days later) » 

4:05 AM
i guess when you folks all come back here to the chat you need some refreshing norwegian music! :-)
ah, and the following video features someone who might be a C++ programmer:
 
4:38 AM
@AlfPSteinbach Not a chance -- I have it on good authority that C++ programmers prefer red guitars, not yellow. We also have enough pity that when somebody's having a headache like that (obviously writing Java) we'd never do anything to make it worse either. The guitarist obviously favored the "yellow" proposal for Ada, thus the pent-up rage.
 
 
2 hours later…
6:36 AM
morning all
 
Morning
Anyone has an idea of SEO?
 
7:02 AM
some yes
 
@RMartinhoFernandes I wish every compiler worked like that. Imagine if just rebuilding your C++ code actually made problems go away ;)
 
7:23 AM
 
Rock is organic now?
 
Als
Hola @TonyTheTiger
Hello @LucDanton
 
Als
What part of the world you are at, you are inhere most times.
I am @work btw, lunch time
 
I'm in mighty Yuropia.
 
Als
7:35 AM
I see
 
@Als ohla
how is your today?
 
Als
@TonyTheTiger: At work..a lilboring
 
oh lol
 
Als
Oh an interesting Question here though that caught my attention
8
Q: Compiler chosing prefix ++ when postfix is missing - who says?

ArbalestWhen you define a prefix operator++ for your user defined type and you don't provide a postfix version, the compiler (in Visual C++ at least) will use the PREFIX version when your code calls the missing POSTFIX version. At least it will give you a warning. But, my question is: Why doesn't it j...

 
I'm not sure about your answer. What does GCC deal badly with, in conformant mode?
 
Als
7:43 AM
I said MSVC does better by using prefix, seems GCC just reports error
MSVC acts more intelligently in this case
and also tells you so
 
Ah okay, I thought you were commenting on the error reporting, not the extension.
 
Als
What is interesting is that Q made me pick up the standard & look for that quote & I was happy I could find the relevant
And did some fair bit of research in hunting down the MSVC messages.
All and all did some research over a Q after long so felt good
 
Research can be quite satisfying indeed.
 
For my first internship I had to track down some RFC's, various software documentation and cross-reference it for all the documentation I had to write.
 
sbi
7:50 AM
@TonyTheTiger "I'd rather be a rising ape than a fallen angel." Terry Pratchett
 
Als
@LucDanton: Indded, but usually it takes time and by the time you do some, someone already posts & then makes you lose interest.
 
@Als I've noticed that by looking up more and more stuff in the Standard I get more familiar with it.
 
@sbi lol
 
So sometimes when I need a reference for my own purposes I can remember how I already looked something up.
 
Als
@LucDanton: Yes, but dont know I find it incredibly hard to understand the standard unless I give it ample of time.
Which i am not able to take out always.
 
7:53 AM
 
Als
@sbi: Hello & thanks for that answer on meta, that was sort of something I was looking up to.
 
@Als yeah, but again, the more you look things up in it, the easier it generally becomes to understand
 
sbi
@Als Glad you like it. Let's see whether it changes anything. Since, except for seven upvotes, nobody seems to support the idea, I don't have much hope, though.
 
Als
@jalf: true that. So I try whenever I get a chance.
@sbi: Yes, lets hope so because I was just getting fed up for marking everything Not Sure, For me it is an failure of the feature really.
 
@sbi link?
 
sbi
7:58 AM
7
A: More information is needed in chat Flagged Posts

sbiThe room a message appears in is urgently needed. Java bashing would be offensive in the Java room, but might be fine in the C# room, so when I see a message bashing Java, knowing the room is absolutely necessary to know whether this message is offensive. However, as Anna pointed out, the room ...

 
8:14 AM
@sbi good answer
let's hope someone listens and implements something along those lines :)
managed to break ms access in about 10 min, meh, I hate that shitty program
 
sbi
@TonyTheTiger Well, @balpha has been there, obviously. But it seems to have got very little attention on meta (60 views, 4 upvotes on the question, and 8 on the answer), and I doubt anybody will see any urgency in this.
Unfortunately, this is inherent to the problem, as only 10k+ users will even understand what it's all about.
 
@sbi I'm getting there...
 
Hi
I'm reading this article about const from Scott Meyers. It's crazy.
decltype(pcs->i)   // int
decltype((pcs->i)) // const int&
 
8:29 AM
Is it?
 
I mean this detail is crazy. The rest of the article is pretty sane :)
 
@kbok You know, it's selfish to talk about interesting stuff you're reading and not post links ;)
 
I just followed @sbi's link :)
 
sbi
@RMartinhoFernandes I'm sure you'll find everything Scott has ever published (linked) at his website, aristeia.com. There's an "articles and interviews" section. I suppose what @kbok is referring to is the one currently at the top of that page.
 
It is.
 
8:41 AM
@FredOverflow I totally want to see the source! :)
 
9:17 AM
<insert random COM bashing here>
> In my code, I have a <vector <vector <vector <vector <std::tr1::shared_ptr<foo> > > > > > named foosBoxes. - Yotam 5 mins ago
 
That's a lot of boxes.
 
9:33 AM
Wait. The thing starts with <. I wonder if it's a typo, or if there's an extra level of vectors.
 
Do you guys think Concepts will ever make it into C++?
 
Depends more on if/when someone makes a credible (proof of) implementation.
 
Wasn't that what ConceptGCC was about? I though concepts were scrapped because the committee was not happy with the current proposal.
 
I think ConceptGCC was also used as a counter-example.
 
9:39 AM
Oh. It was broken in some way?
 
It took extremely long to compile something with it.
 
@FredOverflow: Yes, not in our lifetimes :)
 
Initially, I was very excited about Concepts. But honestly, I don't miss them much now.
 
@LucDanton Oh, that's bad. It's not like compilation is incredibly fast as it stands. I don't want slower.
@FredOverflow Have you used the BCCL?
 
@RMartinhoFernandes The what now?
 
9:42 AM
Boost Concept Check Library.
 
No, is it worth looking into?
 
A quick google search gives a c.s.c++ discussion on the removal of concepts. I see some big names in it and I remember reading it.
@FredOverflow I use it in my unit tests.
 
@FredOverflow I haven't tried it yet, but I like the idea.
 
It helps when a newer GCC snapshot subtly breaks something.
 
Do you happen to have some ready-made implementations of C++11 concepts (like say MoveConstructible) for it?
 
9:45 AM
I have rolled my own MoveConstructible and MoveAssignable.
And, in fact, CopyAssignable. I think the Boost concept is closer to the SGI STL concept than the Standard one.
Nevermind that, according to the documentation, SGIAssignable is separate from Assignable. The Standard is mentioned in reference to the latter, too.
I'm not sure why I didn't simply wrIte a template<typename T> struct CopyAssignable: boost::Assignable {};
 
CopyAssignable requires MoveAssignable now. Would that make a difference?
 
I don't check for that.
 
sbi
@LucDanton That can be said for GCC without concepts as well.
 
Let's see if template<typename T> struct CopyAssignable: MoveAssignable<T>, boost::Assignable<T> {}; works as a drop-in replacement.
 
sbi
@RMartinhoFernandes Actually I think there were two concurrent proposals, and they scrapped it because they didn't want the haggling to delay the standard even further.
 
sbi
@FredOverflow There were several tries to implement concepts in libraries - which ultimately lead to the proposal(s) to add them to the language.
@RMartinhoFernandes Indeed. Sorry.
 
The removal of Concepts has a bright side: since then, the standard has about 100 pages less to worry about :)
 
sbi
@FredOverflow Not that a hundred pages more or less would make a significant difference with the current standard...
 
KTHXBYE
lolcode FTW
 
That's not how chatting works. You don't start with the goodbyes, you start with the greetings ;P
 
10:00 AM
I see trolling
 
Is it expected that (void)o calls the templated conversion operator of o?
Instantiated for void (that's the surprising part).
 
It's funny how most of the top voted questions are now prepended with: "This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here."
Seems undemocratic.
 
sbi
@StackedCrooked Yeah, the opinion of the mob is shunned on SO.
 
@RMartinhoFernandes HAI :)
 
HAI
CAN HAS STDIO?
VISIBLE "HAI WORLD!"
KTHXBYE
 
10:14 AM
I love the code for opening a file.
HAI
CAN HAS STDIO?
PLZ OPEN FILE "LOLCATS.TXT"?
AWSUM THX
VISIBLE FILE
O NOES
INVISIBLE "ERROR!"
KTHXBYE
 
What is that, Cobol?
 
@wilx lolcode
 
Oh, ah, I do not hang around 4chan much.
 
sbi
@wilx COBOL is a programming language.
 
So is lolcode.
 
sbi
10:16 AM
@FredOverflow Yeah, but he was asking about COBOL.
 
> The language is not clearly defined in terms of operator priorities and correct syntax, but several functioning interpreters and compilers already exist. The language has been proven Turing-complete.
@sbi The comma would suggest otherwise.
If he had asked "What is that Cobol?" I would have agreed with you.
 
sbi
@FredOverflow How can a language with an as-yet undefined syntax be "proven" to be anything, least of all Turing-complete? Alan would turn in his grave if he saw this.
 
I dunno :)
> Other commands include I HAS A variable for declaring variables, variable R value ("variable [is/are/being] value") for assigning them, sending error messages to the front end via INVISIBLE instead of VISIBLE, and BTW ("by the way") to denote a comment
 
sbi
@FredOverflow No, that would have implied there to be more than one COBOLs. ("This" or "that" COBOL.)
 
@sbi Someone wrote a Brainfuck interpreter in it.
 
sbi
10:21 AM
@CatPlusPlus Do you truly think a language called "Brainfuck" passing a test named after him would stop Mr. Turing from rotating in his grave?
 
@sbi I think you are confusing the terms "turing complete" and "turing test".
The first is about computability, the second about AI.
 
sbi
@FredOverflow Maybe. But then proving something to be <something> is kind of a test, isn't it? :)
 
@RMartinhoFernandes Well thanks to your comments I have rejuvenated my concept check header. Props to you!
 
Oh wait, someone mentioned that.
 
sbi
Oh wait, he realized.
 
10:27 AM
lol
 
Can I join?
 
sbi
@LucDanton You already did.
 
Als
It seems some kids are on the loose, someone crazily voted lot of my old answers :(
 
I got that yesterday.
Someone voted twelve of my questions in two minutes.
 
sbi
@Als You already said so the other day. Didn't these votes got annulled last night?
 
Als
10:29 AM
@sbi: No I am facing ths first time today
almost 17-18 votes in 4/5mins
 
@sbi I remember Alf mentioning the same thing happened to him recently.
 
sbi
@Als Ah, so it was someone else. @RMartinho?
 
Nobody votes on me. :(
 
No, you won't get sympathy votes from me :P
 
Als
@sbi: Yup he said so
Why would someone do this?
 
10:31 AM
They love me?
 
Als
@RMartinhoFernandes: I don't think they love me, then why?
 
They want you to rep cap for the day, so you will be out of competition for some new questions.
 
Als
@RMartinhoFernandes: did those get annuled?
 
sbi
@CatPlusPlus That's because you're just chatting, not answering anymore. Remember? You said so yesterday.
 
sbi
10:32 AM
@RMartinhoFernandes Anyway, it once happened to me, and I flagged for a mod at one of these questions, asking what could be done about it. He looked at it and told me to wait until tomorrow whether the automagic script would pick up those and revert them. And that's just what happened.
 
sbi
@RMartinhoFernandes If it didn't happen to you, you might want to flag for a mod.
 
It was all upvotes, why would I want to flag them?
 
sbi
@RMartinhoFernandes Oh, I didn't know!
Well, it's still not fair, is it? Shall I flag them for you?
 
Als
@RMartinhoFernandes: Those were on Questions
 
sbi
10:33 AM
:)
 
Als
For me they are on for Answers
 
@sbi You're just jealous that no one loves you enough to give you a ton of imaginary points.
:P
 
Als
Oh this feels good I have a secret Admirer :P
 
sbi
@RMartinhoFernandes Am I? And why would I? I don't think I have given an answer per week this year, and still have thrice your rep.
 
That was a low blow.
"Blah blah My rep is bigger than yours."
 
10:40 AM
i know that this is a C++ room but couldnt find a better room for this ques.
is housekeeping like freeing up memory done after threads are destroyed just like its done when a process is killed?
 
sbi
@RMartinhoFernandes Of course, you'd never blow lowly, right? :)
What with "You're just jealous..."
 
i m asking because when i open tabs in firefox i can see in the task manager that firefox is using more memory
but when i close tabs memory is not freed up
and firefox creates threads for each tab
 
I feel dirty.
 
And how is that even remotely related to threading?
 
Someone commented on one of my answers, suggesting people use dev-c++
 
10:42 AM
@CatPlusPlus firefox creates a thread for each tab
 
Did you send them to the tag wiki?
 
No, it doesn't.
 
@RMartinhoFernandes yeah, of course
 
@jalf Flag him.
With fire!
 
We can do that?
 
10:46 AM
I find suggesting Dev-C++ offensive.
 
6
A: Which C/C++ compiler is good to use?

jalfThe two most widely used compilers are probably Microsoft's Visual C++ compiler, and GCC/G++. Both support both C and C++ (although VC++'s C support is mostly limited to the C89 standard, whereas GCC pretty much supports C99). Both are also available for free (in VC++'s case, either by download...

wow, this job is just full of surprises
 
And suggesting Dev-C++ on a thread about... compilers.
Good job, random person!
 
need to write icky bat files now
 
@CatPlusPlus i m sorry for that yes i can see that there is no thread per tab but if 1 thread of a process is destroyed,is housekeeping done?
 
@jalf Run.
With fire.
@lovesh Define "destroyed".
 
10:50 AM
i mean when its done its job
 
So, graceful conclusion?
Yes, things will be cleaned up (except for anything you leaked, of course).
 
sbi
@lovesh What housekeeping are you referring to? Memory, open files, and other handles all belong to the process, not to the thread. (Well, at least on popular OSses they do.) So what's left to clean up when a thread ends in whichever way?
 
Local variables.
Thread stack.
Stuff.
 
@RMartinhoFernandes ah, it's ok. Just a single small script, but I had to figure out how to get the last argument, which is surprisingly icky/weird
 
The last of an unspecified number of arguments?
Does it involve some weird shifting tricks?
 
10:54 AM
yes, and yes
never used that before, but it seems to work
luckily, it's a pretty hacksy script, so it's ok if the code is ugly. I don't actually need to look at any of the other arguments, or worry about how many of them there are
just echo one of two hardcoded strings depending on the last arg
 
:foo
if "%1x" == "x" goto bar
set last=%1
shift
goto foo
:bar
Or something.
 
yeah, I figured it out. Copied the code from a SO answer :)
 
Can I pass empty arguments to that with ""?
 
Here's a theoretic problem: At the dawn of civilization someone builds the first clock ever. How can he measure the clock's accuracy? How can he improve it?
 
I don't understand why I get so angry trying to use CMake :/
 
11:05 AM
@LucDanton because it has a horrendous scripting language?
 
@LucDanton I've been there.
 
@StackedCrooked Since you confused this before, accuracy or resolution?
 
accuracy
 
@StackedCrooked Make it run for several days then check against solar clock.
 
A solar clock is far from accurate.
 
11:07 AM
@RMartinhoFernandes Wait longer then.
How many days the clock has to run before it indicates it's noon sometimes in the night.
 
But the time it takes to go from noon one day to noon the next day, is not always the same.
 
But yeah that might not be the kind of accuracy you care about.
 
Are the time intervals between noons always equal?
 
@LucDanton Because it has Make in it.
 
11:09 AM
@RMartinhoFernandes example?
 
@StackedCrooked That's the kind of accuracy my test is measuring.
 
@LucDanton if the time intervals between noons are equal, then it is a good point of reference I think.
 
Solar time is a reckoning of the passage of time based on the Sun's position in the sky. The fundamental unit of solar time is the day. Two types of solar time are apparent solar time (sundial time) and mean solar time (clock time). Introduction Fix a tall pole vertically in the ground; at some instant during any sunny day the shadow points exactly north or south (or disappears, if the sun is directly overhead). That instant is local apparent noon-- 1200 local apparent time. About 24 hours later the shadow will again point north/south, the sun seeming to have covered a 360-degree arc ar...
> The length of a solar day varies through the year, and the accumulated effect of these variations (known as the equation of time) produces seasonal deviations of up to 16 minutes from the mean.
 
That's a nice order of magnitude for the error of the first clock to ever make :)
 
> Babylonian astronomers knew of the equation of time and were correcting for it as well as the different rotation rate of stars, sidereal time, to obtain a mean solar time much more accurate than their water clocks.
Impressive.
 
11:13 AM
On that note, the Boost libraries are in /usr/local/lib and my compiler doesn't look here. What must I do for CMake to pass a -L option to the compiler or whatever?
 
Damn impressive.
I think: link_directories("/usr/local/lib")
 
Isn't CMake all about being portable?
How is hard coding paths portable?
 
you're just adding to the list of libraries it should search in
 
The portable way is using find_library possibly. I have no idea how it works.
 
so you can specify both windows and linux paths
can tell it to search in %PATH% as well
find_library works by calling a per-library script which tries to look in a handful of common locations
 
11:19 AM
What if I have boost in /im_stupid_and_i_use_crazy_directories/lib
 
then you add that dir with link_directories
or add it to LIB_PATH environment variable or something, and then tell cmake to read that as well
 
I don't expect users to change a build script.
 
Do you mean the script that searches for Boost uses link_directories?
 
or make it a property you can configure when invoking cmake :)
 
Ah, that sounds more like it.
 
11:21 AM
@RMartinhoFernandes I think you can set LDFLAGS environment variable before running cmake.
 
something like OPTION(varname, description, default_value)
 
Similar to LDFLAGS=/usr/local/lib ./configure
 
but it is certainly possible to write non-portable cmake scripts
guess what I've spent the last week or so with ;)
 
CMake, and now Windows batch files?
 
actually, the .cmd/bat file I mentioned is called by one of Cmake's find_library scripts :)
 
11:22 AM
hello all
 
it calls a script that only exists on linux, so I had to hack together a fake version of it for windows. ;)
 
build scripts eh
 
#
# Detect PLATFORM and ARCH variables
#
if(WIN32)
    set(PLATFORM Windows)
    set(ARCH x86)
else()
    execute_process(COMMAND uname OUTPUT_VARIABLE PLATFORM)
    string(REPLACE "\n" "" PLATFORM ${PLATFORM})
    execute_process(COMMAND arch OUTPUT_VARIABLE ARCH)
    string(REPLACE "\n" "" ARCH ${ARCH})
endif()
^ Sometimes it gets messy.
 
That's what cmake scripts look like?
 
11:24 AM
@RMartinhoFernandes this is not a very idiomatic example though
 
Are if(), else(), and endif() functions (or CMake's equivalent of that)?
Please say no.
 
> In a higher-level language, like C++, it’s enough to say that a data race leads to undefined behavior. But at a processor level, everything is defined.
 
@RMartinhoFernandes it's not really a programming language
This is an example from one of my projects: CMakeLists.txt.
 
@RMartinhoFernandes not sure, but they behave as if/else/endif
 
@StackedCrooked But someone decided to stick if() in it.
 
11:26 AM
I suffered a little.
 
woah, so CPU has no "undefined behaviour", I wonder then how it is created at C++ level? I mean, what causes it do anything at all? I computer needs an instruction do something right? So what instruction is it executing while exhibiting UB? I"m confused
 
the idea behind cmake is nice, and the features enabled by it are nice, but the actual language is disgusting
 
@TonyTheTiger "So what instruction is it executing while exhibiting UB?" It's undefined.
 
@TonyTheTiger what instruction is executing when you do a buffer overrun?
 
@RMartinhoFernandes it's more like a macro language
 
11:27 AM
@RMartinhoFernandes so it just jumps randomly?
 
the CPU doesn't have a "buffer overrun" instruction, and yet it is possible for those to occur :)
 
@TonyTheTiger Consider that C++ is implemented across a variety of architectures, not to mention CPUs. C++ the language is not designed towards the CPU, it's designed towards the compiler.
 
@TonyTheTiger no, but the compiler generates whatever code it likes
 
the IP register has to be pointing to something?
 
the CPU executes the code generated by the compiler
 
11:28 AM
Actually, some processors have undefined behaviour as well, AFAIK.
 
@TonyTheTiger No, it does end up running something specific, but you can't say what from looking at the code.
 
in the buffer overrun case (which is UB), a register holding an address just ends up holding a too large address, and the instructions say to read or write from that address
 
@jalf yea I know, it just ends up in memory with no executable code, in most cases, or ends up executing shell code, if exploit
 
@jalf I was enthousiatic about the ability to generate Visual Studio and Xcode projects. However it outputs weird projects.
 
Usually, it's some memory access or something.
 
11:29 AM
@TonyTheTiger nah, it doesn't have to jump anywhere. It can execute valid instructions on invalid data too
 
@jalf true that
but why then not have a safe place to jump to when UB occurs, instead of doing whatever the hell seems like interesting to do?
 
@TonyTheTiger that would require you to detect all cases of UB
 
Safe place?
 
and then you might as well generate a compiler error
 
By safe place, you meant &exit right?
 
11:30 AM
@jalf hmmm that might not be possible, halting problem
 
I'd like to give the Poco build system a try.
 
@TonyTheTiger: Clang supposedly can generate abort()s at places where you can only get because of UB.
 
@RMartinhoFernandes yea
 
My real problem with CMake is that I have no idea what the documentation means. Looking for a tutorial that happens to explain what you're trying to achieve is not a good way to learn how to use something.
 
@TonyTheTiger exactly. The point in UB is generally that the compiler doesn't detect it. It generates code that could have been valid, if only it'd operated on valid data. And then at runtime, you end up passing some invalid data to it, and unpredictable things happen
 
11:33 AM
but like an illegal pointer dereference, would that not be detectable? Does an OS have no notion of the address ranges used by an executable running on, therefore anything outside that range, could already be illegal, however I guess, that within that range, how would you know what it should point at? Hmmm
 
My blog is the third result for "c++11 gcc" on Bing. I don't get it.
 
@jalf hmmm yea I can see that
 
of course, there's the other kind too. Say you take a garbage pointer, cast it to a function pointer type, and then call the function
 
@TonyTheTiger The OS does have some notion of that. That's why you can get segfaults.
 
then the instruction pointer jumps to some garbage location, and you'll end up executing some funny-looking instructions
 
11:34 AM
so the compiler still generates instructions for the CPU to execute, however the result of those instruction in case of UB is not predictable
 
But inside your own pages, it usually lets you do whatever you want.
 
@TonyTheTiger exactly. That's why you get access violations for some out of bounds errors
 
@TonyTheTiger It can be predictable.
 
@RMartinhoFernandes I thought that some pages in a process are read-only, other write-read, etc? Specifically to protect against BoF type attacks?
 
@TonyTheTiger Mainly to prevent processes from messign with other processes.
 
11:36 AM
@TonyTheTiger yep, but each page has a fixed size (typically 4kb). Inside a readable page, anythnig goes
 
cause like the .data section of an executable is supposed to be read-only, but perhaps that's only at proc level
 
so you can stomp over plenty of garbage data still
say you call newto allocate a single int. That gives you 4 bytes of usable data, as far as C++ is concerned, but if you ask the OS, it might have given you an entirely new 4KB page
all of which is now writable
 
hmmm.
interesting
 
or even worse, it might not have given you a new page, but instead found an unused 4 bytes on a page you were already using. Now a buffer overrun might overwrite data you were actually using
 
Usually the system has no idea of what your process is doing inside it's pages.
"Here's a page, go nuts on it."
To detect buffer-overflows inside your pages would require a means to tell the OS where buffers start and end.
And checks somewhere, possibly degrading performance.
 
11:41 AM
@jalf Each new results in a 4KB page??
 
@StackedCrooked implementation-defned, of course, but no
new/malloc implements its own memory manager while knows "ok, I've got 3.9kb from the last page I still haven't used. Use that before we ask the OS for a new page"
it was just a simplified example :)
sometimes, new will result in a new 4kb page
 
Ah I see.
 
@jalf I'm not sure that the memory manager at that level needs to worry about pages per se. Are you sure that it has a notion of pages in there?
 
anyway, UB is really about not keeping your promises to the compiler. The compiler thinks that when it sees a function pointer, it points to a function or it is null, and so it "knows" that when it sees a call to a function pointer, it can assume that you'll be jumping to valid code (or null, which halts the process). Then you pass it a garbage pointer, and it works by the same old assumption, and so it just generates "jump to that address" code, regardless of the fact that it's UB
 
11:44 AM
same with buffer overruns. You allocate a fixed-size buffer, and the language rules specify that pointer arithmethics within that buffer aren't going to go beyond the bounds of the buffer, so the compiler "knows" that the resulting pointer will be safe. So it generates code on the assumption that the pointer is safe
@TonyTheTiger at some level in the hierarchy it does. Again, simplified a bit :)
there are quite a few layers of abstraction in between
 
yea, that's what I gathered.
 
but again, implementation-defined. new could internally do all this bookkeeping, and deal directly with virtual memory pages. But it typically doesn't.
because that kind of memory manager stuff could be useful to more than just C++, so the OS provides a bunch of services that do part of it, and then there's probably some language-specific policies on top as well
 
what's this do asm volatile
why the volatile keyword?
 
GCC
it's on Linux
 
11:53 AM
iirc it's just to tell the compiler that the following asm block should be treated as volatile. Because GCC otherwise tries to interpret and optimize it
rather than jsut treating it as an opaque asm block
 
GCC tries to optimize your asm? How rude.
 
pretty sure, yeah
 
Is something wrong with this answer? stackoverflow.com/questions/7091797/…
 
woah... optimizing asm... :P
 

« first day (305 days earlier)      last day (4657 days later) »