|
Wheany posted:no, actually the best first language is C64 basic because that is what i learned first and i turned out fine. This except Tandy TRS-80 BASIC.
|
# ? Nov 23, 2016 16:48 |
|
|
# ? May 24, 2024 05:04 |
|
LeftistMuslimObama posted:can someone explain this meme to me? its clearly from before my time c foo s => current foo status (from cjs thread which doesn't actually stand for computer janitors contrary to popular belief) also uh that _main thing is stupid. every compiler i know of has a C Runtime object that exports a __start label, program execution begins there and it is __start that is responsible for calling main
|
# ? Nov 23, 2016 16:55 |
|
Xarn posted:I could tell you, but then I would have to kill you. that's what I'm doing! but it's stupid, I want a method that does both. compare expectation: return stack.pop(); reality: auto value = std::move(stack.top()); stack.pop(); return value; Sapozhnik posted:also uh that _main thing is stupid. every compiler i know of has a C Runtime object that exports a __start label, program execution begins there and it is __start that is responsible for calling main gcc was ported to windows in a very stupid way. the greatest irony is that the dos port was a better windows compiler than the windows port
|
# ? Nov 23, 2016 17:14 |
|
hackbunny posted:that's what I'm doing! but it's stupid, I want a method that does both. compare expectation: they probably don't want to hide the fact that the "TopPop" method would have to implicitly make a copy somewhere to return the value, or use an r-value constructor also, there might be some issues with exception safety guarantees
|
# ? Nov 23, 2016 17:23 |
|
hackbunny posted:that's what I'm doing! but it's stupid, I want a method that does both. compare expectation: More serious answer then: In C++98, you could either have exception safety or convenient API, because if you had something like C++ code:
Now, in a world with noexcept move, you could do a bit of template magic and make pop move return T iff T has no-except moves, similarly to map::find (which can take comparable types, not just the Key type, if the comparator supports it), but nobody bothered. Also it would be kinda weird and confusing to have different return types depending on the templated-upon type. I guess you can make a standardization paper, there have been some interesting container interface changes lately so this might pass as well.
|
# ? Nov 23, 2016 17:28 |
|
windows executables do have static initializers but they're badly named and you can easily miss them. I won't blame you if you do because even microsoft missed it. what you have to do is add a tls directory with a list of callbacks, callbacks are identical to dllmain but with a void return value (ie. they can't veto thread creation), so they get called at process creation, thread creation, thread exit and process exit. microsoft themselves forgot about it and so you get things like _beginthread/_endthread because duh the main executable doesn't have a dllmain and doesn't get thread notifications! and if I add a tls directory the module can't be loaded dynamically except of course, imbeciles, the main executable is always loaded statically. another aspect of windows development that borland understood better than microsoft
|
# ? Nov 23, 2016 17:29 |
|
Xarn posted:More serious answer then: in an implementation like this: // e: maybe I should use std::move_if_noexcept here so that a failed move doesn't leave a corrupted object in the stack auto value = std::move(stack.top()); stack.pop(); return value; isn't the "return value" line guaranteed to be non-throwing, by now? because the return value is not copied or moved but constructed in its final place. or is it still just an optional optimization? Xarn posted:I guess you can make a standardization paper, there have been some interesting container interface changes lately so this might pass as well. I don't know if I know the standard well enough to make a proposal hackbunny fucked around with this message at 17:49 on Nov 23, 2016 |
# ? Nov 23, 2016 17:39 |
|
hackbunny posted:in an implementation like this: In C++14 its still only optional optimization. In C++17... dunno, didn't really bother looking up the proposed rules for guaranteed copy elision yet, but I think its for cases where RVO was supposed to kick in (and not NRVO).
|
# ? Nov 23, 2016 17:56 |
|
Sapozhnik posted:c foo s => current foo status (from cjs thread which doesn't actually stand for computer janitors contrary to popular belief) to expand this a bit: one of the original computer-janitor chat threads was called "current job status" (i.e. CJS). people began making posts where they would share some dumb thing they had to do at work that day, written (for example) like "cjs: scraping boogers off the underside of the desk that belonged to the guy who just got fired" or "cjs: reimaging bob's machine for the third time this week because he can't help but click on phishing emails". this "joke" was then generalized to the form of "c<something>s: <example in the 'something' category>". so in the post LMO quoted the "c c++14 s:" expands to "current c++14 status: <thing about lol why is c++14 so dumb>"
|
# ? Nov 23, 2016 18:04 |
|
Xarn posted:In C++14 its still only optional optimization. In C++17... dunno, didn't really bother looking up the proposed rules for guaranteed copy elision yet, but I think its for cases where RVO was supposed to kick in (and not NRVO). this is horrible, you're telling me there's no safe way to modify a container and return a value from it. short of explicitly returning the value through a by reference argument I guess
|
# ? Nov 23, 2016 18:14 |
|
Lutha Mahtin posted:to expand this a bit: one of the original computer-janitor chat threads was called "current job status" (i.e. CJS). people began making posts where they would share some dumb thing they had to do at work that day, written (for example) like "cjs: scraping boogers off the underside of the desk that belonged to the guy who just got fired" or "cjs: reimaging bob's machine for the third time this week because he can't help but click on phishing emails". this "joke" was then generalized to the form of "c<something>s: <example in the 'something' category>". so in the post LMO quoted the "c c++14 s:" expands to "current c++14 status: <thing about lol why is c++14 so dumb>"
|
# ? Nov 23, 2016 18:17 |
|
Lutha Mahtin posted:to expand this a bit: one of the original computer-janitor chat threads was called "current job status" (i.e. CJS). people began making posts where they would share some dumb thing they had to do at work that day, written (for example) like "cjs: scraping boogers off the underside of the desk that belonged to the guy who just got fired" or "cjs: reimaging bob's machine for the third time this week because he can't help but click on phishing emails". this "joke" was then generalized to the form of "c<something>s: <example in the 'something' category>". so in the post LMO quoted the "c c++14 s:" expands to "current c++14 status: <thing about lol why is c++14 so dumb>" did you really just write this all out
|
# ? Nov 23, 2016 18:47 |
|
hackbunny posted:this is horrible, you're telling me there's no safe way to modify a container and return a value from it. short of explicitly returning the value through a by reference argument I guess Yep, if you can't place any constraints on types (like "has noexcept moves, because we are not savages"), then you have to either change the interface, or not be exception safe. Depending on your use case, you could change the API, like this C++ code:
|
# ? Nov 23, 2016 18:50 |
|
if someone in this thread does end up submitting a proposal for a "move and pop" method, please follow standard yospos conventions and name it poop()
|
# ? Nov 23, 2016 19:00 |
|
Xarn posted:Yep, if you can't place any constraints on types (like "has noexcept moves, because we are not savages"), then you have to either change the interface, or not be exception safe.
|
# ? Nov 23, 2016 20:51 |
|
seems easier to just remove the method if the value isn't nothrow movableC++ code:
hackbunny fucked around with this message at 21:18 on Nov 23, 2016 |
# ? Nov 23, 2016 21:03 |
So how does noexcept work? It's sort of like const-correctness in that you have to explicitly state it for each function, right? But unlike const-correctness the compiler can't catch noexcept mistakes for you?
|
|
# ? Nov 23, 2016 21:24 |
|
VikingofRock posted:So how does noexcept work? It's sort of like const-correctness in that you have to explicitly state it for each function, right? But unlike const-correctness the compiler can't catch noexcept mistakes for you? throwing out of a noexcept function calls std::terminate. it's sort of the opposite of const in that it gives well-defined semantics to bad code rather than trying to help the compiler catch bad code with undefined results if you bypass it.
|
# ? Nov 23, 2016 21:41 |
|
redleader posted:whoops i just wasted minutes of my life on this planet trying to find what the c++ spec means by "ill-formed" for some reason in practice it means that you have written something which is not a valid c++ program but which a compiler will probably accept without complaint
|
# ? Nov 23, 2016 21:42 |
|
Plorkyeran posted:in practice it means that you have written something which is not a valid c++ program but which a compiler will probably accept without complaint seems to me that the compiler should probably reject invalid programs
|
# ? Nov 23, 2016 23:08 |
|
qntm posted:seems to me that the compiler should probably reject invalid programs
|
# ? Nov 23, 2016 23:11 |
|
anthonypants posted:but then there wouldn't be any programs left works as designed
|
# ? Nov 23, 2016 23:13 |
qntm posted:seems to me that the compiler should probably reject invalid programs I eagerly await the post that explains why this is equivalent to solving the halting problem or whatever.
|
|
# ? Nov 23, 2016 23:22 |
|
there must be at least some situations where a compiler could detect an ill-formed program and bail out - perhaps e.g. if someone tries to call main()?
|
# ? Nov 23, 2016 23:39 |
|
today i worked with some dudes that were not allowed to type 'rm -r' -- like if they typed those keys, even in an editor, it would log them out lmao i was watching screenshare, so not poking around at it myself, but I wonder if they typed like 'rm<space><backspace><space>-<space><backspace><space>r' it wouldn't catch it lol
|
# ? Nov 23, 2016 23:39 |
|
VOTE YES ON 69 posted:today i worked with some dudes that were not allowed to type 'rm -r' -- like if they typed those keys, even in an editor, it would log them out lmao
|
# ? Nov 23, 2016 23:41 |
|
i would guess that 'rm -f' was blocked too but who knows whoever thinks its important for employees to be subject to poo poo like that is maybe not the sharpest tool in the shed
|
# ? Nov 23, 2016 23:43 |
|
VOTE YES ON 69 posted:today i worked with some dudes that were not allowed to type 'rm -r' -- like if they typed those keys, even in an editor, it would log them out lmao alias rem=rm
|
# ? Nov 23, 2016 23:48 |
|
VOTE YES ON 69 posted:i would guess that 'rm -f' was blocked too
|
# ? Nov 23, 2016 23:51 |
|
VOTE YES ON 69 posted:today i worked with some dudes that were not allowed to type 'rm -r' -- like if they typed those keys, even in an editor, it would log them out lmao
|
# ? Nov 24, 2016 00:09 |
|
"oh yeah that's easy, just run transform -rotFUCK"
|
# ? Nov 24, 2016 00:12 |
|
i wish I had a shell on their system, would be fun to gently caress around with and see how abusable it iscode:
|
# ? Nov 24, 2016 00:20 |
|
i discovered a couple days before i left HS that one of our computer lab servers was configured to allow any user to run sudo nice sudo nice bash would have been great fun if i weren't a pussy
|
# ? Nov 24, 2016 00:42 |
|
redleader posted:there must be at least some situations where a compiler could detect an ill-formed program and bail out - perhaps e.g. if someone tries to call main()? yes, compiler errors are a thing that exist, and a lot of compiler warnings and static analyzer checks are for things that probably make a program ill-formed VikingofRock posted:I eagerly await the post that explains why this is equivalent to solving the halting problem or whatever. if (program_halts()) { *((int *)0) = 0; }
|
# ? Nov 24, 2016 01:35 |
gonadic io posted:alias rem=rm install rip
|
|
# ? Nov 24, 2016 02:45 |
|
Plorkyeran posted:if (program_halts()) { *((int *)0) = 0; } I was thinking about this one. I think you have to show that a program that would differentiate between a malformed and a 'proper' program would also solve the halting problem, right?
|
# ? Nov 24, 2016 03:16 |
|
Ploft-shell crab posted:I was thinking about this one. https://en.wikipedia.org/wiki/Rice%27s_theorem
|
# ? Nov 24, 2016 03:22 |
|
Ploft-shell crab posted:I was thinking about this one. right, it should actually be if (program_is_well_formed()) { *((int *)0) = 0; } such that it's well-formed only if it isn't, since an ill-formed program neither halts nor doesn't halt
|
# ? Nov 24, 2016 05:09 |
|
Plorkyeran posted:right, it should actually be if (program_is_well_formed()) { *((int *)0) = 0; } such that it's well-formed only if it isn't, since an ill-formed program neither halts nor doesn't halt wouldn't having that null pointer dereference make your program ill-formed regardless of whether you get to that clause or not, in the same way that having undefined behavior anywhere in your program invalidates the whole thing and not just what comes after?
|
# ? Nov 24, 2016 16:04 |
|
|
# ? May 24, 2024 05:04 |
|
Deep Dish Fuckfest posted:wouldn't having that null pointer dereference make your program ill-formed regardless of whether you get to that clause or not, in the same way that having undefined behavior anywhere in your program invalidates the whole thing and not just what comes after? Undefined behaviour invalidates the path leading to it (and also any path following) and not the whole program. Basically, with this code C++ code:
C++ code:
|
# ? Nov 24, 2016 17:24 |