« first day (1132 days earlier)      last day (3831 days later) » 

9:00 AM
not in coliru
that's weird - it just doesn't work - coliru.stacked-crooked.com/a/4594d9d89baa6459
 
user1804599
Functions can have side-effects, silly.
 
worth a warning, though :)
 
ah, right. in a = b you ignore return value of op=
 
user1804599
a = a = b :)
 
@rightfold empty() doesn't have any effects, unlike the verb empty. Imagine if your mother told you to empty the trash and you just returned a no every time?
11
 
9:10 AM
@Mikhail empty() is not named after the verb, but after the adjective
You are entirely correct that if you call a function that does something other than what you thought, then your code will not work. But it does not necessarily follow that "the error lies with the function, because it does something other than what I thought"
 
9:23 AM
It's silly naming convention
Should be is_empty
 
Xeo
empty?
 
And the rename clear to empty!
And shrink_to_fit to empty!!
That doesn't even make sense
 
And then push_back to empty!!!
 
Just call everything !
 
I think empty makes sense if you know words have more than 1 definition.
 
9:25 AM
@CatPlusPlus no, shrink_to_fit should be almost_empty then :P
 
Principle of least surprise, which C++ is really bad at
There's no reason to not call it in a predicative way
 
I avoid almost all naming boilerplate. No is_ or anything else.
 
@CatPlusPlus expect and assume nothing, then it's unlikely you get surprised ;)
 
Well, other than stupid people whining about 3 characters, but that's only funny
@ArneMertz I assume everything is shit and doesn't work like it should
And it's true!
@Potatoswatter It's not boilerplate
 
If I have my way with my nascent operator void proposal, empty() could return a proxy which calls clear if you fail to use it, i.e. convert it to bool.
 
9:27 AM
Great idea
Would fit right in
 
@CatPlusPlus even then C++ will violate the principle of least surprise, because often it will surprise you by actually working like it should.
 
@Potatoswatter Wow
 
@ArneMertz Haven't encountered that yet
 
although "work like it should" is opinion based - call it "work like intended" :P
 
I don't trust orcs
 
9:29 AM
Orking is much better than working.
 
I'm orking right now
 
NSFO
 
well, if a class has N public methods, you probably should name them f1, f2, ... fN
 
room topic changed to Lounge<C++>: Come ork with us. [c++] [c++11] [c++1y] [no-questions]
 
@Abyx Nah, too obvious
Use a random letter and random number for each one
 
9:30 AM
@CatPlusPlus maybe then you should shift your expectations of how it should work more in line to how it is intended to work ;)
 
@ArneMertz How it's intended to work is what's the problem with it
So, no
 
@CatPlusPlus so, basically you don't agree with the language/library designers' choices and intentions?
 
Wow, IBM XLC has bene an incremental compiler for 15 years. (ref)
 
WTF, why does the Unicode website link to the 6.2 pdfs from the 6.3 page.
 
has anyone used this?
 
9:39 AM
@Potatoswatter Bene!
 
Huh..
0
Q: Unexpected Runtime error

Hani GocI have a runtime error and I don't know what is happening. These are the classes Class 1: TfIdf.h struct maxoccur { int _M_val; int _M_rep; maxoccur() : _M_val(0), _M_rep(0) {} void operator()(const std::pair<int,int> &e) { if ( _M_rep < e.second ...

Never seen this outside of GCC
the whole _M_val thing
 
Oh.
> The core specification is not being republished for Version 6.3. Thus the chapters of the core specification use the Version 6.2.0 PDF files.
WTF, how lazy is that.
 
What, text encoding draft editors are going to edit a draft text file in a text editor?
 
@Rapptz It's a reserved identifier
 
Yeah I know. Underscore + capital letter.
I just think it's weird someone would willingly do it.
 
9:43 AM
People are dumb
They've probably seen it somewhere and just copy it without thinking
 
Probably used the standard library sources as a style guide.
 
@Rapptz a lot of people see it in the std lib headers and think "that must be what my code should look like"
 
That's probably not the source of any actual error though, because identifiers with lowercase won't be used for macros.
 
@Rapptz I have no idea what I'm talking about but INTERNET POINTS so I'll just try to guess!
 
9:47 AM
0
Q: Why is my code comment using the most CPU time?

learnvstOk, forgive the tongue-in-cheek question title, but when time profiling some code using instruments, it flags the most intensive operation as a comment . . The function gamma(float) is never called, and the code above the screenshot is only used to fill a lookup table when the program is init...

nice profiler lol
 
@Potatoswatter By the way, the issue tracker for the draft thing is for editorial errors like typos and stuff. I just noticed you posted an error there about actual C++ (it tells you this in the README, surprised you didn't catch it)
I just noticed it's 4:49 AM ._.
 
@Rapptz I also mailed it to the editor just to be sure :)
Find the cursor!
 
where the highlighting ends?
 
Nope, it's not completely invisible.
 
9:54 AM
Right next to that :: over there.
 
Close enough!
 
The cursor is drunk and went home
 
btw robot
I was reading your docs for ogonek
and you said using byte = std::uint8_t but it's actually unsigned char
I know they're the same thing (when CHAR_BIT == 8) but it felt weird
 
why can't compilers use the actual typedefs used in the declarations/definitions of the functions envolved in the error messages?
 
because C++
 
9:58 AM
@ArneMertz Sometimes they do.
(Perhaps you have an old compiler?)
 
I know GCC does something like where std::string = std::basic_string<char>
 
also int is better than some::impl::cls<A, B, C>::my_int_t
 
@R.MartinhoFernandes well, I didn't mean my compiler (it's not that old but behaves worse than grandpa's VC6). I meant that flood of template chaos in the screenshot above
 
ooh somone fucked up the build big time
 
-4
Q: how template binding happens in C++ (compile time or runtime)?

user3016896This question was asked by interviewer: how template binding happens in C++ (compile time or runtime) ? and how they will be linked ?

lol
 
10:00 AM
it's been down since like monday
 
@ArneMertz That looks like a stack trace in GDB, but I could be wrong.
 
Also I will be dropping my fabulous idea
 
---Type <return> to continue, or q <return> to quit--- is what tipped me off.
 
I concluded that complicated behavioral trees or chains are just too fucking... complicated.
Especially in that poor-piss language that JS is.
I might revisit that topic sometime in future in Haskell.
what's up?
 
@R.MartinhoFernandes hm and gdb can't have the typedef information to produce nicer stack traces?
 
10:02 AM
@Potatoswatter bash>screen many times?
 
@Rapptz Oh. Thanks. I'm requiring bytes = octets because sanity (UTF-8 in non-8-bit machines? Fuck off), but a compiler is still allowed to have an actual unsigned 8-bit type that is distinct from unsigned char and use that for uint8_t (and FFS they should!) .
 
uint8_t bums me out because if you print it you get a character rather than a number so you have to explicitly cast it :/
since they just do typedef unsigned char uint8_t
 
Yeah, they should not. That's so silly.
(Breaking change now and whatnot)
@ArneMertz It can only have whatever goes in the debug info. Typedefs are purely API features, so I'm not sure how easy that would be to track along in the binary.
 
@R.MartinhoFernandes I'm not convinced that the breaking change would not be worth it. The confusion amongst newbs, (and some more experienced), re. chars/ints/uint8 is pretty horrifying on SO. Stupid, stupid C.
 
uint8_t being unsigned char is more of a compiler laziness thing than C I think.
 
user1804599
10:11 AM
Never break someone else’s existing code.
 
It's already broken.
 
Such a change would merely make it loudly broken.
 
I don't feel like "the code compiles under C++x but not under C++(x+3)" is breaking anything
 
TIL binary literals are going to be introduced in C++14 (I thought they were already there).
 
10:12 AM
@BartekBanachewicz It is.
This is a completely different issue.
It's QoI, not conformance.
@Jefffrey Ugh :(
 
@Jefffrey They're useless but alas, they're there if you want them.
 
char as a numeric type is a really stupid idea
It should've been called byte and forced to be unsigned
But hey, C
 
@CatPlusPlus Since it's actually a byte, it's more like "char as a character type is a stupid idea".
 
@Rapptz Well, std::bitset<4> x = 0b0011 is nicer than std::bitset<4> x = "0011".
 
@R.MartinhoFernandes Well, it's a couple of stupid ideas
Both in naming and in purpose
 
10:15 AM
@CatPlusPlus I'm tempted to star that, but it's not really newsworthy to most of us - it's a given.
 
Also signedness
 
@Jefffrey I guess.
 
char types have tri-state signedness.
 
random, signed and unsigned.
 
@Jefffrey Yes, that doesn't sound particularly useful :S
 
10:16 AM
Heh - 'signed characters'. Unless you have a physical pen in your hand and a real paper document to sign, it's nonsense.
 
I know. :/
 
user1804599
Binary literals are not useless.
 
@MartinJames It's like a character that you hash and then encrypt.
 
The proposal for the binary literals actually has no use case or motivation sections.
Just checked.
 
I'm imagining the conversation that led to char as something like "— we should totally have a type that's a character, but it's numeric, but it doesn't behave like other numeric types! — I'M SO STONED MAN"
3
 
10:17 AM
@Rapptz lolololol
 
@R.MartinhoFernandes :)
 
@Rapptz Gotta love the process.
 
user1804599
There is also no reason to not support them.
 
@rightfold Yeah basically the overview is summarised as "Other languages have it, we should too"
 
@rightfold Yes, there is: "there is no reason to add useless features" is good reason to not support them.
 
10:19 AM
Remove octal literals also
They're even more useless than binary ones
They're used by about ONE FUNCTION
Like, seriously, who has ever used an octal literal outside of chmod()
 
All of us.
 
user1804599
Yes I love code that uses cryptic hexadecimal numbers for masks used in serialisation.
 
0 is an octal literal according to the C++ standard. :P
 
@Rapptz Shut up about 0.
 
:lol:
 
10:20 AM
@R.MartinhoFernandes TOO LATE.
 
I had a manager who hated hex with a passion. I was doing embedded programming so I would be watching a raw memory map, and he was over my shoulder like "are you sure you don't want to look at that in binary?"
 
@rightfold Cryptic binary numbers are much better.
 
@CatPlusPlus basically what happened
 
(Hint: the bad thing about "cryptic hexadecimal numbers" is the first word, not the second)
 
Binary literals are very desirable in, say, drivers. Octal is just fucking useless.
 
10:21 AM
Octal literals in C++ show how dumb it really was in copying really really dumb ideas from C
 
Our operating system will have one function that could use octal literals BETTER ADD THEM TO CORE LANGUAGE
 
> I'M SO STONED
 
Coincidentally chmod also sucks
 
Right. Octal literals are appropriate because nobody will ever need more than three levels of three types of permission :P
 
This is all funny and all, but what's the problem in having octals and binaries? You might not find them useful, but someone may.
 
10:23 AM
@CatPlusPlus 777 all the way.
 
Yeah..
 
@Jefffrey That someone finds useless features useful sounds like a problem to me :P
 
@Jefffrey I can see binary having a use case somehow but not octal.
 
@R.MartinhoFernandes Useless is very subjective.
 
10:24 AM
Octal literals are useless
 
@Jefffrey When there are no use cases presented, it is quite objective.
 
@Rapptz Does that means that it doesn't exists?
 
I think so.
 
stackoverflow.com/questions/892126/… - fuck me not this thing again!
 
Why would you use base 8
For anything
 
10:25 AM
It's faster!
 
I don't think anyone's ever used octal literals outside of the single special case for it.
 
@Abyx 242 votes on the answer o_O
 
@Rapptz The user manuals of my embedded controllers show the bit patterns of the registers. I want to type in my required bit pattern in binary, not prat about with soddin' tables of hex bit-masks and & long strings of them together.
 
@R.MartinhoFernandes and now it doesn't work in MSVS2013
 
@R.MartinhoFernandes Ahahaha. I've got an answer to a dupe :/ Never saw that Q from 2009
 
10:26 AM
@MartinJames Yeah. Binary literals can aid in readability, I can see that. Can't say the same for octal literals.
 
My eyeballs learned to convert hex<->bin when I was about 8 years old. Don't know about you guys.
 
@Abyx The workaround doesn't? Nicely, they deleted the original bug (or at least the permalink broke)
 
I can only convert 0 and multiples of FF
 
The octal numeral system, or oct for short, is the base-8 number system, and uses the digits 0 to 7. Octal numerals can be made from binary numerals by grouping consecutive binary digits into groups of three (starting from the right). For example, the binary representation for decimal 74 is 1001010, which can be grouped into (00)1 001 010 – so the octal representation is 112. In the decimal system each decimal place is a power of ten. For example: : \mathbf{74}_{10} = \mathbf{7} \times 10^1 + \mathbf{4} \times 10^0 In the octal system each place is a power of eight. For example: : \math...
 
We know what octal is thanks
 
10:27 AM
Someone should submit a bug like "Workaround stopped working".
 
lol
 
@CatPlusPlus Hint: the link points to a specific paragraph
 
Hint: what you linked says why it is useless
 
lolno
 
@CatPlusPlus multiples of $100, a.k.a. Benjamins?
 
10:28 AM
tl;dr "the only use case in modern times is chmod"
 
@Jefffrey Yes, it does. It lists obsolete machines and chmod.
It also explains at length how goshdarn awkward it is when shoehorned into other use cases.
 
> Octal representation of non-ASCII bytes may be particularly handy with UTF-8, where any start byte has octal value \3nn and any continuation byte has octal value \2nn.
 
"May" but isn't and doesn't justify them
 
Ok, what's the problem in having them? Does that affect you in anyway?
 
Hex still conveys more information about UTF-8 bytes less awkwardly.
 
10:30 AM
The grammar for them is crap
 
Specially for start bytes, you can quickly see how long the sequence is.
 
Or in hex where start bytes start C, D, E, F and continuation bytes 8, 9, A, B
 
So what?
 
@Jefffrey 0100
 
So compiler won't warn you if you accidentally use an octal literal, and it is very possible
 
user1804599
10:31 AM
@R.MartinhoFernandes They’re not cryptic as they actually show you which bits are going to be affected by the operation.
 
@Jefffrey It says so right there in the section you linked.
 
It's about as useful as EBCDIC
 
@CatPlusPlus About once a month on SO.
 
@rightfold lol, how helpful. "touch bit 0" is totally not cryptic.
 
But hey some obsolete crap mainframes also used EBCDIC so I guess we should support it!
 
10:34 AM
0b1010 & 0b1101 isn't so bad.
 
@Rapptz It's still cryptic, though. It's like slapping a band-aid over a stab wound.
 
I don't see it, but okay.
 
Basically, I have a hard time accepting examples of "improvements" that involve writing expressions with magic numbers.
 
They're examples. Don't overthink them.
 
Well, they fail to paint a convincing picture.
 
10:42 AM
enum class flags : char {
    first = 0b1000,
    second = 0b0100,
    third = 0b0010,
    fourth = 0b0001
};

int main() {
    // something something
}
 
I use bit shifts for that :S
(Or a constexpr bit(n) function that does bit shifts)
 
@R.MartinhoFernandes Me too. If I had the choice from the very beginning I'd use binary literals though.
Maybe I'm weird for finding it readable, I don't know.
 
user1804599
const (
    fourth = 1 << iota
    third
    second
    first
)
 
ugh, I slept like 4 hrs
 
10:46 AM
My second use case doesn't even compile lol
 
@TonyTheLion ;)
 
I'm derping
 
@TonyTheLion You want to be petted?
 
I'm feeling a bit dog-eared too. Three pints of Cobra in the Indian, 4 poppadoms and a huge thermonuclear phall, bombay aloo, aloo gobi. pilau rice etc. We finished up in the club where I had an unknown number of extra beers. Not doing that too often:)
 
10:54 AM
@R.MartinhoFernandes No, its the derp face
 
2
A: How does one use an enum class as a set of flags?

PotatoswatterTemplates play well with enum class so you can define sets of operators that work on sets of similar enumeration types. The key is to use a traits template to specify what interface(s) each enumeration conforms/subscribes to. As a start: enum class mood_flag { jumpy, happy, upset, ...

 
is @rightfold around?
 
It's 7 pm, my GF is starving, I still haven't showered, my crashing is fixed, till later y'all :)
 
mood_flag? "My interrupt controller is feeling a bit sad today, but at least it's not angry".
 
@MartinJames Maybe you're programming a Furby.
 
10:57 AM
@Potatoswatter A Furby would be more useful ATM:(
 
fuck pascal/delphi. I hate that language.
 
What if you could unsend an email already sent. So that it dissapears from the recipients email inbox. So that emails sent by mistake can be undone.
 

« first day (1132 days earlier)      last day (3831 days later) »