« first day (396 days earlier)      last day (4554 days later) » 

user784668
5:00 PM
Does anyone know anybody who've written anything in it?
 
@KerrekSB (the obvious example where it's easy to do being dynamic_cast towards a base, from a derived)
 
[d:\dev\libraries\progrock\cppx_dev\documentation\u\examples]
> (cl /nologo- 2>&1) | find "++"
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86

[d:\dev\libraries\progrock\cppx_dev\documentation\u\examples]
> _
 
Als
hola
@awoodland: Are you done with your townhall meet?
 
@Als - starts in 2 hours
I think I might be able to guess your question
 
Als
haha
Guess!
 
5:03 PM
offensive language in chat?
 
Als
That's one
 
I suspect my view would be popular here, but not universally popular
 
Als
I guess you are libreral but not politically correct then.
 
Hm? What's happening?
 
I see chat as far more of a social thing than the main site
if people choose to swear in a pub or whatever I don't really care
on the main site it's unprofessional and the answers are expected to be a useful resource for everyone forever
 
Als
5:06 PM
@EtiennedeMartel: Nothing much..
@awoodland: Do you suggest unmoderated chats?
 
@Als I wouldn't go that far - that's asking for spam and other possible problems
 
@EtiennedeMartel Oh, one of those, I'm going to code a game, and I think everyone starts from scratch by picking a language to code in without any other considerations. Is C# fast for games?
 
if someone's deeply unhappy they can make their own PG13 chat room
 
Als
hmm..
 
"Just because you have a hammer, doesn't mean you're ready to build a house."
 
5:08 PM
and chat with other people who share that view
 
Als
I don't know if I would be on by the town hall but I have this one specific Q if anyone can ask it.
What do you think would be your course of action on serial Downvoting complaints/flags?

a. Discard them as something that cannot be helped with(Few Mods have stuck to this action).
b. Actively pursue the root cause & try to help(Atleast one Mod demonstrated this action)
 
guys, to me this code looks just fine. But VC++ complains theres an unhandled exception at Line:28 paste.cdtag.de/view.php?id=6248
 
hello all
 
Als
grr...roars @TonyTheLion
 
hahaha
how is things?
 
Als
5:10 PM
@TonyTheLion: I am playing townhall with @awoodland
:P
 
@Als I'd check the list of downvoted stuff. If there's a poor trend in answers or questions that are downvoted, it's not my fault someone wants to make a point to another user that they have poor quality of thought.
 
@als - did you want me to answer that specific one now?
or would that spoil the surprise?
 
Als
@awoodland: Not really, You can answer it in the TownHall but I am not sure if i would be there, so if I am not and someone from here is please do ask that one.
 
However, if the downvoted content varied enough, or there's a history of a grudge or malicious intent in the comments, then I'd take action
How long will the chat history be up after the chat is over?
 
they did say candidates could ask questions too, but I suspect I'm going to be struggling to keep up enough as it is to ask anything
 
Als
5:12 PM
@Xaade: Get there on the podium :P
 
@Xaade the one from the beginning of this year is still online
 
@Als huh? Is that a game?
 
someone promised to write a summary on meta I think
 
It should be easy enough to shout out the odd question, "Ok, WHO WANTS COOKIES?"
 
Als
@TonyTheLion: Yes, You get to screw people who might screw you for the next entire year.
:P
 
5:14 PM
Sounds fun.
 
@Als I can't nominate myself for mod. No matter how kickass of a mod I'd be, I don't have the badges, rep, or IRL rep to garner votes.
Oh and BTW, I'd be a kickass mod.
 
Als
@Xaade: Yeah add to that you are outspoken :)
 
I'm very good with PR.
 
Als
not criticizing but yeah thats PR == outspoken
 
@Als Add to that I'm not politically correct. I judge fairly.
 
Als
5:15 PM
@EtiennedeMartel: You can also join in and throw a few stones :)
@Xaade: Fairly, as you think, not necessarily in fairness
 
Or throw grenades.
 
My goal would be to establish a system that checks if you answer with a really short answer, edit a few minutes later, and get a ton of flags. If there's a pattern such that this is the way you answer every time. Then I temp ban you.
 
Als
Why do you consider that bad?
 
@Als Well, if the majority of answers are low quality... then it is a problem. So I'd have to calculate quality in as well.
 
Als
You said Answers not Questions
 
5:20 PM
@Als typo
 
Als
Why do you want to ban people for writing better answer than what they already wrote?
 
Point being. If someone is spray and praying bad answers out there using a quick-draw technique, and answering only stuff from low rep people (who don't usually know how to recognize a bad answer), this is bad for community. The poster doesn't get a good answer, bad ideas are spread, and the quality of SO goes down.
@Als No no.... you're missing my point. Read the above, I think that's more clear of my intent.
A way to recognize this is to check if they're posting too quick and editing afterwards, and if the majority of their answers are on questions from low-rep posters, and if the majority of their answers have relatively low votes.
 
@Xaade - is that a huge problem? On the C++ tag for example most people post bad answers here for downvotes/comments and that seems quite effective from what I've seen of it
it seems pretty rare for a bad answer to outscore a good one
 
Als
@Xaade: If an answer is bad it might get upvoted for being posted first but it gets downvoted later on from users who understand that it is wrong.
 
@awoodland If they're spamming, yes it is bad. It bloats the site.
You have to check for high volume, low quality, High answer count / day, quick answering, and answers mostly OP with low-rep.
 
Als
5:26 PM
@Xaade: You may even want to ban people for upvoting wrong answers?
That hits quality too.
 
@awoodland It doesn't have to outscore. @Als It doesn't have to be bad enough to get downvoted.
 
Any opinions on this answer? What about " UB for the standard not the function."?
 
Als
@Xaade: And its just your perspective on good and bad
 
@xaade - outscore is useful, because it rewrads the better answer more and places it higher on the list of things people see when they find the question
 
Which brings up another question. Should we allow answers with overwhelming downvotes to continue to be visible? I say make them only available to the poster, so he can delete at some point.
@awoodland Yeah, but then you end up with someone with high amounts of rep that have no business having that rep. Given enough time, they could get "moderator" tools, or the ability to vote to close, etc.
 
5:29 PM
hello may I ask one question about pointers in C here?
 
@onorua can you pretend it's pointers in C++ or is it C specific?
 
Als
@onorua: Shoot
 
@Als Only if there's a voting trend. If they go about aimlessly upvoting, then yes, I'd consider some penalty.
serial upvoting is just as bad as serial downvoting.
 
Als
@Xaade: :) Autocratic
aint voting for you :)
 
But seriously. Primarily, if I were a mod, I'd fit the mod of SO. If mods aren't expected to do something, I wouldn't do it. My personal goals would not be reflected in my adherence to duty if they are counter to the goals of SO.
 
5:33 PM
@KerrekSB I don't like the quote about UB you pasted, but I'm not quite sure how to answer it - I think what they're trying to say is more along the lines of "if you limit yourself to a specific platform+implementation which makes sufficient extra promises and you're prepared to take the hit on portability then it could be viable"
 
@Als Who said I would take these actions alone. I thought I stated that it would be a consideration.
 
It's in pure C, whell I have some configuration file, and I want to use it. I'm trying to create something like:
typedef struct {
int sc_gen_cntr;
GENERAL **sc_gen;
} CONFIG;

then I want to use it:
CONFIG * pconfig = (CONFIG *) config;

int cnt = pconfig->sc_gen_cntr;
pconfig->sc_gen = (GENERAL **) realloc(pconfig->sc_gen, (cnt+1) *sizeof(GENERAL *));
pconfig->sc_gen[cnt] = malloc(sizeof(GENERAL));
pconfig->sc_gen[cnt]->var = strdup(name);
pconfig->sc_gen[cnt]->val = strdup(value);
pconfig->sc_gen_cntr++;
 
They'd mostly be indicator tools to help notify the mod community that there's a user that's detrimental to the website. It may not result in a penalty, but it may result in more closely watching the user for offensive conduct.
27 mins ago, by Als
What do you think would be your course of action on serial Downvoting complaints/flags?

a. Discard them as something that cannot be helped with(Few Mods have stuck to this action).
b. Actively pursue the root cause & try to help(Atleast one Mod demonstrated this action)
 
I think I'm definint that dynamic array of pointers wrong
 
@Als how can you wonder about this question, without admitting that users can be detrimental to SO?
 
5:36 PM
defining*
 
Als
@Xaade: huh
 
@Xaade you can be detrimental in a lot more ways than just mediocre answers
 
@onorua Hover over the left side of your post to the chat. Click down arrow. Select edit.
 
@Xaade thanks!
 
@Als You want to prevent serial downvoting, but you think I'm autocratic for wanting to prevent gaming rep?
 
Als
5:39 PM
@Xaade: Thats your idea of gaming rep.
 
Someone with gamed rep has the ability to vote to close, view close votes (which means they can harass their closers), get "moderator tools", etc. All powers that don't belong to someone detrimental to SO.
 
Can someone explaine me, how to create dynamic array of pointers to poineters to a structure?
is it ***p?
I'm sorry that I interrupt your conversation
 
@Als That's how it's done. You post an answer that is not wrong. Then you edit later using content from other answers. Since you start out at the top, people vote for you because they think you originated the stolen content.
 
@onorua - that's one of the reasons I prefer C++ over C
 
Als
@Xaade: Me?
:)
 
5:41 PM
@Als No, I mean, That's how "One" would game. Using the above.
 
@awoodland yes, but I need C in this case.. so am I right about ***p ? that's the dynamic array of pointers to pointers?
 
@xaade - I have a sneaking suspicion that given 3 answers, one from a user with 1 rep, one from a 1k rep user and 1 from a 10k rep user the 10k user is far more likely to get votes just because people read the rep
 
Als
@Xaade: If you think thats gaming, why do you allow edits in short time spans?
 
@onorua an array of pointers to pointers is a sure sign that my design needs more thought
 
@awoodland It's not just "platform-specific". The point is that you cannot legally dereference a punned pointer.
 
Als
5:43 PM
@awoodland: I would say thats true. Users trust rep, but thats the point of rep being there ain't it?
 
pointer to pointer to pointer looks reasonable, but makes me deeply unconfortable
 
@Als That's one solution. Put a timer between edits. But those solutions just annoy people that have a legit reason to edit a portion of their question to refine it.
 
@awoodland The correctness of the code doesn't depend on the platform, but on the input value. I'd say that's not good.
 
@awoodland That's true. Which is why gaming is a windfall. The higher your rep the easier it is to game for rep.
 
@Als yeah and it's quite likely the higher rep user is simply better at expressing answers too
@KerrekSB are they missing an & there?
 
Als
5:45 PM
@awoodland: Yes and as i see, short correct and easy to understand answers earn most rep.
 
@awoodland Not if they cheat their way to high rep.
 
@awoodland Me too, that's why I'm asking the question here :) as it's not really comfortable to work with.. well.. how does most of you parse complicated configuration files? what are the most common approaches?
 
@KerrekSB ((uint16_t*)(&xyz))- the & there would make a lot more sense wouldn't it?
@onorua - the one really complicated configuration file format I've had to use I used flex and bison to read
which meant that the final format was really expressive
it took me 3 goes to get a sane grammar though
 
@awoodland No, that's UB. It's "type punning".
You are only allowed to dereference a pointer to the correct type.
since xyz (not &xyz, by the way, xyz is already an array) is not a pointer to a uint16_t, you're invoking UB.
 
@kerreksb - yup, and the union trick is UB too
 
5:48 PM
@awoodland Yes
 
i wonder what do you guys do if you have a cold? i mean, a severe cold?
do you still go to work?
 
@JohannesSchaublitb I work from home usually
 
If you have a function f(uint16_t*), then an invocation f((uint16_t*)p) is only acceptable if p has been obtained in some way as a pointer to the correct type.
 
@KerrekSB - but if your platform promises to let you get away with that and you accept that it's only your platform making the promise is it too terrible? (the correct answer presumably would be to write a "char[2] to uint16_t" function that uses bitshifts and | to load it into the right place before calling ntohs
 
i was told that real men go to work even if they need to sneeze all the way through day.
but usually i stay at home because then it goes away faster
 
5:52 PM
@KerrekSB - So I'd probably use your solution with a ntohs call
 
with rvalue unions you can type pun without undefined behavior
 
why is the value of this is 1 instead of 0 int x(double()); std::cout<<x; ?
 
but it's sort-of not really thought of by the spec I think, so it's just a grey area
 
@KerrekSB - since you know the incoming values are always network byte order you can reconstruct the short and then have a possibly swap it with htons
 
Xeo
@JohannesSchaublitb example?
 
5:55 PM
union A { int a; float b; }; float x = A{10}.b;
now this reinterprets an int as a float
but without violating the aliasing rules because there is no glvalue involved
 
Xeo
freaky
 
of course this is a grey area but by pure language semantics, it is not necessarily undefined behavior
but since the representation of floats and ints are unspecified, effectively the behavior is still undefined.
 
@JohannesSchaublitb there's a risk that might get "fixed" in a DR anyway isn't there?
 
@awoodland it's similar to how struct A { A() { } int x; }; int y = A().x; currently is not undefined behavior, but should be
both of this and the previous union example are based on the same underlying problem of course. both are because A().x is an rvalue already, and misses the read.
 
@JohannesSchaublitb - but reading from y in that second example would still be UB right?
 
5:58 PM
@awoodland The correct answer is to start with the target type and cast that to char* and write to that. There's no standard-conforming way to start with a char-array and interpret the data in-place.
 
@MrAnubis You've got a Most Vexing Parse problem going on there, but once you fix that the result is 0, not 1
 
@awoodland i don't think so. you have an int value and initialize it with that value. so why should it be UB?
it is not like y would be uninitialized or something
 
@Praetorian i am unaware of MVP
 
@awoodland The only time I can see ntohs being useful is if you do something like this: unsigned short int mynums[100]; fill_data((char*)mynums); for(...) htons(mynums + i);
 
what about this form:
typedef struct {
int sc_gen_cntr;
GENERAL (*sc_gen)[];
} CONFIG;

CONFIG * pconfig = (CONFIG *) user;
int cnt = pconfig->sc_gen_cntr;


pconfig->sc_gen = realloc(pconfig->sc_gen, (cnt+1) *sizeof(GENERAL));
pconfig->sc_gen[cnt]->var = strdup(name);
 
6:00 PM
Emphasis on starting with the correct type.
If you are just handed a bunch of bytes, I don't think there's any standard-conforming way that gets around doing some copying.
 
@KerrekSB - OH, I thought they wanted a unit16_t to fall out at the end
 
@awoodland They do, but you can't have that for free if you don't already start with one.
If all you're given is a heap of bytes, you have to make copies.
In other words, there's no "placement-assmembly" in C++ that tells you "this type goes there".
 
@MrAnubis int x(double()); std::cout<<x; here x gets parsed as a function returning an int and taking a function that returns a double as an argument. Most vexing parse
You can fix it by adding an extra set of parentheses int x((double())); std::cout<<x;
 
Xeo
5
A: Why does `basic_ios::swap` only do a partial swap?

Howard HinnantYou can blame me for this one. The committee has tried to change (twice I think), but each time the solution ended up breaking things. Swap and move semantics was retrofitted onto our I/O system a decade after it was designed. And it wasn't a perfectly clean fit. Note that basic_ios::swap is ...

Interesting.
 
@JohannesSchaublitb This is a different case, but I find it odd that writing to b followed by reading from n is considered undefined behavior here: union { uint32_t n; uint8_t b[4]; }
 
6:10 PM
@KerrekSB - ideone.com/iM3V9
doesn't that cut it?
 
@StackedCrooked Is there no exception for char members of a union?
 
@awoodland Missing semicolon.
 
@KerrekSB Not that I am not aware of.
 
@StackedCrooked - uint32_t might have different alignment requirements
 
6:11 PM
@awoodland Sure it does. As I said, you end up making copies!
By the way, I don't think CHAR_BIT is appropriate. Serialization requires a prescribed format, which includes that bytes are 8-bit wide.
@awoodland But char is guaranteed to align to 1.
 
@KerrekSB uint8_t only exist on implementations where CHAR_BIT is 8.
 
@RMartinhoFernandes Are you serious?
 
@StackedCrooked it isn't undefined behavior
 
@JohannesSchaublitb Care to elaborate?
 
any object has unsigned char compound objects inside, so when you read from b you are fine
 
6:13 PM
@KerrekSB Because char cannot be smaller than 8 (it must be large enough to hold an UTF-8 code unit), and if uint8_t exists then the byte must be a multiple of 8 bits.
 
he said "write to b"...
 
because there are unsigned char objects at the respective addresses. (and you can read with unsigned char anything anyway).
 
@StackedCrooked how about cases where uint32_t lives in a different register to uint8_t[4]?
 
@RMartinhoFernandes Yes yes, but what if CHAR_BIT is bigger?
 
@KerrekSB Then uint8_t doesn't exist.
 
6:14 PM
uint8_t only has at least 8 bits, non?
 
ah yeah if you read from n then it is undefined
 
@KerrekSB No. Exactly.
That's why uint_least8_t exists.
 
@RMartinhoFernandes Oh, really? Same for the other ones?
 
@awoodland Hm.. Can this happen?
 
@KerrekSB Yep.
 
6:15 PM
in an union, every member starts at the same address so alignment should be no issue I think
 
@RMartinhoFernandes Ahh. I always thought it was "at least". OK. Yes, then that's fine. (Though then you might as well say 8.)
 
@StackedCrooked you could have an architecture that has a special register for ints and a special register for "small arrays"
so you write to n and that sets the special int register
and you read from b and it reads a totally different register
because it believed you
 
Ah, I see. uint8_t is "optional", while uint_least8_t is mandatory.
 
Hey, that sounds like something my theoretical implementation must have.
 
@RMartinhoFernandes - I can think of an architecture that might do that for int vs short[2]
 
6:18 PM
@Praetorian but if this is the case , we never defined the function x , so this should give compilation error rather then giving x value 1 , isn't it?
 
I think what one can say is that in any serialized byte stream, each byte must have value at most 255. Then you can serialize and deserialize the format from any conforming C++ implementation.
 
@awoodland I guess I could avoid this by using volatile, but it's getting hackish then.
 
@StackedCrooked - volatile doesn't change where it's stored
 
Doesn't volatile prevent storing the value in a register?
 
it means you load it on every read
but not storing it in a register would mean you can't do anything with it on a lot of platforms
 
6:20 PM
That guy @JohannesSchaublitb reads tons of books? knows too much :D
 
no im not reading many books...
lol
and i don't know too much... im teh c++ nerd
 
get life man :D
 
Oh, I see, the cast-through-union is actually suggested in this answer...
So it is UB, right?
Reading and writing out of order?
 
That's what I've read (in the standard, not somewhere on the interwebs)
 
@RMartinhoFernandes I've always thought that, too.
checks
Hm, I can't actually find it. 9.5 doesn't mention writing and reading of different members, it only says "active member".
 
6:30 PM
@MrAnubis He knows too much. He should be eliminated.
 
@MrAnubis Yes, you'll get a linker error. You have to fix it to get the result, which is 0
 
6:42 PM
aaargh fuck you visual studio ICE :(
 
you should report it on Connect
not because it'll get fixed, but because then we can bet on how soon it'll get a WONTFIX
 
what, so they can WONTFIX?
 
yes
 
lol
even if they do fix it and ship the fix in VC12
I'll still have to workaround in the meantime
 
also because I'm planning to write another grumpy blog post about how they deal with bugs
 
6:44 PM
they deal with bugs?
 
so getting more examples of bugs reported that they ignored will be handy
if I ever get around to doing it
@DeadMG by closing them, yes
 
see, that's one way in which it will be easy for me to make a splash with WideC
just ship a decent implementation which actually fixes bugs and ships them to the customers
of course, an implementation written by me likely won't ever have bugs
ahem
 
Not sure about "easy". There's a fair bit of work involved in fixing bugs in a complex product. ;)
 
true
 
@DeadMG You fix bugs that are reported. And you only get reports if you have users.
2
 
6:48 PM
but I'll bet you dollars to donuts that their compiler has been incrementally upgraded from assembly to C++
and half of it, or more, is a steaming pile of junk
 
So, your plan to get users depends on you having users in the first place.
 
whereas I have Modern C++ all the way
@RMartinhoFernandes No, it's a small part of my plan to get users
mostly part of how to keep them
well
at least whilst I can't compile my project, I may as well add support for stuff like string and integer literals ;p
 
$ grep typedef -r *
$
Mwhahahaha! Bye bye typedef.
 
lol
 

« first day (396 days earlier)      last day (4554 days later) »