« first day (959 days earlier)      last day (3998 days later) » 

12:01 AM
Indeed. During one experiment the compiler crashed because it exceeded it's max template recursions. It tried to generate code for any number of VLAN tags.
 
@StackedCrooked Ouch!
 
It was kinda funny :)
 
Ell
Can't you edit compiler recursion limit?
 
However, the code in that experiment was much faster.
20 million pps on my first trial.
 
what's the normal pps?
 
12:02 AM
@StackedCrooked Crashing compiler does always have at least a little humor, but can waste a lot of time before it finally crashes.
 
optimizing Wide isn't something I'm looking forward to
will probably have to go memory-mapped files or someshit
 
@DeadMG Current software, which is used for testing 100Mbit networks, can do 200-300k pps.
 
ah, so MUCH faster
 
However, the new software will be used to test 1G and 10G networks.
Yeah, the old code was a typical Java-like OO design and it used as much pointers as possible.
Also it uses locks on each network layer.
 
lol
ow
 
12:05 AM
There are packets going up the stack, and packets going down the stack, therefore..
Lock order is not consistent!
It
is a nightmare.
The new design will only allow one thread to access the stack. So sending and receiving will have to be sequentialized.
@Ell Turns out that I only need to support 1 VLAN tag.
So that's easy.
 
@StackedCrooked Who do you work for anyway?
 
THE CIA
 
@CCInc Doubt it. Stuff like this mostly falls under the CIA (and not in Belgium).
 
Better just don't mention the name at all.
The people that work there are not always good programmers, but they know the full TCP/IP stack inside out.
When I applied for a job there I knew next to nothing about networks. My only selling point was that I was good at programming.
 
Xeo
12:23 AM
Sounds like you're having fun with the project
Also, time for Wall of Flesh in Terraria, I guess... ugh.
That's bound to hurt.
 
@Xeo Yeah :)
 
Xeo
That's good
 
@CCInc One of these days I'll have to learn how to type. s/CIA/NSA/ in my earlier reply.
 
That's always good to know how.
 
@StackedCrooked Each layer should have only one input queue, and the direction of the incoming buffer should be a bool/enum member if the buffer class. Packets flowing both ways should be no problem at all.
One input queue=one lock, so no problem with lock ordering.
 
12:39 AM
I have no motivation for my current project :\
 
+1, but answers using indices like this need to start using C++14's std::integer_sequence :) — Jonathan Wakely 12 mins ago
It is tempting.
 
Xeo
@LucDanton Eh, I think he's promoting it a bit too much at this stage
Since really only GCC has it, IIRC
 
I've mentioned C++14 in some previous answers before so that's actually the kind of things I do.
 
Ell
@stacked crooked how did you learn it? Did they train you?
Or were you expected to learn yourself?
 
@Ell I guess by immersion. Working with network technology every day..
 
12:48 AM
std::make_index_sequence<N> sure is verbose. I like Indices<N> and IndicesFor<Tuple> :(
Who is Ann and why does she have so much to say?
 
Ann?
 
Ell
@stacked what did you have on your CV to get the job? Ie, degree? Experience?
 
@Ell Experience in software development. My degree is not very impressive.
 
Ell
I need a completed project to show potential employees
 
potential employees or potential employers?
 
Ell
12:52 AM
Shame I can't put the work in
And oops. Potential employers. Its late xD
 
If I have a player and a ship.
Would the direction from the ship to the player be expressed like so:
 
@Ell NO! You are just anticipating promotion and becoming boss of your interviewer :)
 
laserDirection = (Math.Atan2(Math.Sin(position.Y - player.Position.Y), Math.Cos(position.X - player.Position.X)));
 
Ell
I've no idea :S
 
I don't think I can think of math right now. I feel I did something like this before, but something was wrong. I just don't remember what it was.
 
Ell
12:59 AM
I could probably do if I was more awake :3
Pen and paper goes a long way with maths I think
 
Drawing would probably help, yes.
 
Would this be considered a poor idea? the casting
 
Xeo
...
Great
 
Ell
Why not just construct it?
 
Xeo
I was so afraid of fighting the Wall of Flesh in Terraria, and then the fight wasn't even a minute long
 
Ell
1:02 AM
But you are returning a reference to a local there I think
Which is UB. Someone correct me?
Oh wait.
 
Should be a reference to the actual primitive in the array, but...
 
Ell
Idk xD
Why are you doing this?
 
I've been treating my "Foo" array as just POD because, the class that holds it doesn't need to know.
 
Just checking something - if I have a non-pure virtual destructor in a base class, and a derived class with the destructor defined, but empty, there's no possible thing that would change by removing that destructor (derived one), right?
 
@Kivin Yes and no. In this case, just doing a cast is safe. Using a C-style cast is not so good. Using this-> (in this situation) isn't exactly good either.
 
1:04 AM
I don't know why, but having names like Foo and Bar just confuse me more...
 
@LuchianGrigore I believe that's correct, yes.
 
@JerryCoffin: Thanks. I only added this-> to demonstrate the example properly since it is so incomplete.
 
@JerryCoffin well, I also "believe". I want someone to confirm and be able to take the blame if something goes wrong.
 
If I took out this-> (it never made it in to the actual code, to be truthful) and used a reinterpret_cast<>, it wouldn't raise too many eyebrows?
 
@LuchianGrigore I have no problem with you blaming me.
@Kivin I believe you want a static cast in this case.
 
1:06 AM
@LuchianGrigore: Blame me, everyone does so anyways.
Static cast... damn. Just when I think I understand this crap. Okay. Let's give it a shot :)
Nope, static_cast<> wont convert unsigned short in to a struct reference
 
Xeo
@LuchianGrigore If you remove the empty dtor, the compiler will just generate one...
 
@Kivin My apologies.
 
@Xeo exactly. But the question is "there's no possible way anything could break,. right?"
 
No trouble. Just one word
 
You can't return a Foo& unless an actual Foo is involved somewhere.
 
Xeo
1:10 AM
Or a derived version thereof
Although I guess that counts as "involved somewhere"
 
or something that can be interpreted as a Foo & Foo is a standard layout class.
 
Yup. Base subobject.
 
The compiler isn't gagging on it and the unit tests are succeeding
 
That's not saying much.
 
Assuming the struct is just POD (no virtual classes, whatever), is there anything beyond simple "this looks weird as heck" that says you shouldn't cast a primitive to a struct reference?
 
1:12 AM
@LucDanton Given that Foo is a POD, casting Foo to the type of its initial member is required to yield the initial member. Seems like doing the reverse should work as well.
 
Ell
It doesn't make sense to me
How can you cast an int to a reference?
A reference is a static thing
 
@Ell What does that mean?
 
Ell
It doesn't have a value, does it? Its an alias
 
@Ell about the same way something like int &f() { static int x; return x; } works.
 
Ell
I can understand a pointer, because it has a value (the memory address)
 
1:13 AM
A reference is a pointer, too. It is just syntactically different.
 
@Ell What it aliases is not necessarily known at compile-time though. E.g. int& ref = std::cin.get() ? i : j;.
 
It compiles out to a pointer.
 
Ell
Meh. Yeah. I'm stupid.
 
It makes the guarantee that it actually points to something (as opposed to NULL) and eliminates the ugly arrow operator
Okay, here's another question. Had my original example used pointers instead of references, would it still be gross?
 
Ell
Can you reinterpret_cast to a reference?
 
1:16 AM
@Kivin That's different.
 
Ell
Ignore me. I'm tired, I need to keep my trap shut
 
Oops, there should be a & before data[i], like pastebin.com/nT4Jsn6x
Apparently you can, @Ell. I''m doing it right now in VS2010 and it's working.
a la my first pastebin up top
 
@Kivin Why not just simplify things a lot and change Foo to just typedef unsigned short Foo;?
 
Jerry, because it has methods in the actual code.
But it by definition is just an unsigned short
 
Ell
Why are you using an array of unsigned short?
And maybe you want free functions
 
1:18 AM
@Kivin That has serious potential for changing the answer completely. If any of the member functions is virtual, for example, the answers change completely.
 
@LuchianGrigore I don't think that stands. There are provisions for inspecting the common initial sequence of standard layout class types in a union, but not through a pointer, is there?
 
@JerryCoffin: I'm aware that virtual is a different ball game. The data type is, by def, just an unsigned short with helper methods.
 
@JerryCoffin That involves a Foo.
At both ends I mean.
@Kivin You can't call a member function unless you have an actual object of the right type. Do you?
(Non-static of course.)
 
I'm not 100% sure I understand your question, but if a struct is POD, can't it be said to be == to its constituent type(s)?
 
Ell
From what I gather I think free functions would avoid this, or constructing an object and returning it
 
1:23 AM
@Kivin Have to agree on the meaning of 'equal' here.
 
Equal as in their binary representation. What the member functions operate on.
 
> If a non-static member function of a class X is called for an object that is not of type X, or of a type derived from X, the behavior is undefined.
There you go. It's so important it has its own rule. I cannot emphasise this too much: normally undefined things are, by definition, left undefined.
@Kivin Then no. And even if they were, that's not the problem.
 
yiz
Howday
 
Why not use non-member functions?
 
Is that excerpt explicitly covering my original pastebin, the casting of a primitive to a struct reference?
 
1:26 AM
@Kivin Is a Foo involved somewhere, or is it not?
I.e. I can't answer unless I know what data is.
 
data is an "malloc"ed block of memory divisible by sizeof(unsigned short)
 
Oh, that does affect things a lot.
If it so happens that sizeof(Foo) exactly matches sizeof(unsigned short) then you're good to go. (Foo being trivial also being a requirement.)
 
Yeah, foo is guaranteed to have 0 virtual constituents and exactly 1 member whose type is unsigned short.
 
That does not guarantee the size. Nothing can. (Normally one uses a static_assertion or some such to document and enforce the assumption though.)
 
Oh, well that's okay then.
If I chase my Foo definition in Foo.h with a static_assert, everything is happy?
 
1:30 AM
If or when you do assert the size then I would still recommend that you allocate memory using sizeof(Foo) as a reference, seems more future-proof to me.
And at that point you really have a (dynamic) array of Foo. Less magic involved.
 
Yeah, agreed.
 
It's also saner to pass around void*, char* or unsigned char* around rather than unsigned short* or something else for such an array.
Can't trip up aliasing rules by accident.
 
aliasing rules?
 
In the same spirit of the non-static member function rules, generally speaking you can't read or write through a pointer to T* unless there's really a T involved, although there are exceptions.
 
That's understandable
Good heavens C++ is complicated when you go off the beaten track a little bit.
All these questions stemmed from trying to understand someone else's code. He has a "FooRef" class which stores a "Bar &" and the "i" index in the array and every method of "FooRef" exactly matches "Foo". I went :? and wondered why he did it.
 
Ell
1:39 AM
Seems strange
 
Exactly matches Foo in purpose, the code actually does pointer arithmetic every time you call FooRef::something()
 
Ell
To me non member function is the way to go
 
Yeah might have made more sense. Heh.
He doesn't even document "FooRef". His code says "We want you to think of it as "just a Foo"
 
Xeo
holy crap, the hardmode enemies are.... hard.
 
Duck typing in C++. lol.
 
Xeo
1:40 AM
Who'd have guessed.
 
@Xeo ya don't say :P
 
@Xeo: Impossible.
 
Xeo
The jump in difficulty is just much bigger than expected. :(
 
Hardmode what exactly?
 
Xeo
Terraria
 
1:42 AM
Ooh.
Wife can't wait for Starbound.
I'm not sure they'll ever finish coding it though. I've watched excepts of their "coding live-streams"... blargh.
 
Ell
Scrub away scrub away scrub away, the sr way
 
Xeo
alright, mission accomplished anyways... time to head to sleep
g'night
 
Ell
Night
 
Ciao
 
Xeo
> You've earned the "Great Answer" badge for What is “rvalue reference for *this”?. See your profile.
yay
sudden votes today pushed it over 100
 
1:53 AM
Oh, if I name it join then concat(map(f, r)) isn't the same as concat_map(f, r) :( This changes everything!
I'll call the other append and too bad if it's variadic.
, EnableIf<
    std::is_reference<Reference<Range>>
>...
 
2:10 AM
LinkedIn just recommended a "Domagoj Pandza" as someone I might know O.o
 
o.O
is linkedin stalking your SO chatting activity?
 
Dammit. Got bit by the explicit default constructor of std::forward_list again.
 
Hmm, never seen this before.
 
I sent him a request, but since nobody here knows my real name he'll probably deny it
 
 
2:27 AM
I'm surprised there is no factory for std::reverse_iterator. Oh well.
 
2:47 AM
Coding music anyone?
 
3:03 AM
7 hours ago, by Tony The Lion
> The men who program in C++ are Real Men. The women who program in C++ are Real Men too. You can spot a C++ programmer from their testosterone fueled swagger, and the unbelievable amount of contempt they inject into the phrase Java "programmer". They'll probably do the air quotes and all. source
you missed semicolon at the end of the line... ;)
 
3:38 AM
One problem that I have with generic programming is end up with long symbol names like: Futile::Stack::BasicProtocol<Futile::Stack::ARPProtocol, Futile::Stack::ARPDecoder, Futile::Stack::ARPProtocolConfig>::pop(Futile::Stack::Session&, Futile::Stack::ReceivedData const&)
I really makes stack traces hard to read.
 
I end up missing typedefs in C#.
 
4:01 AM
> attempt to decrement a past-the-end iterator.
That's not helpful :|
 
4:20 AM
Are string constants in a code-file encoded in whatever text encoding the code file uses, or does the standard say that "" is ascii/latin1/local 8bit, or something like that?
 
Implementation-specific encoding for narrow strings.
 
"Implementation-specific"? As in, the compiler decides?
 
E.g. with GCC the -fexec-charset option governs that.
 
Gotcha.
 
Note that u8"Hullo" literals are guaranteed to be encoded in UTF-8, but confusingly are also referred to as narrow string literals :s
 
4:28 AM
Right, but I don't use c++11 yet
 
5:24 AM
@Xeo Finally have added as_const and decay which I suppose are the associated expressions of AddConst and Decay in a way.
 
5:45 AM
What the fuck is happening here? When did become infested with dicks? See behaviour of OP, some commenters, and one 'answerer'.
 
6:07 AM
can one explain this vote for close effect? stackoverflow.com/questions/16869087/…
for god sake
....
 
22 mins ago, by Luc Danton
What the fuck is happening here? When did become infested with dicks? See behaviour of OP, some commenters, and one 'answerer'.
There's no close option for being a dick obviously but I suppose that doesn't stop some people.
 
What a shitty answer
 
what, a dick, common....
 
I deleted my comments on your question because I don't want to be associated with it in any way.
 
Anyway you're being smug in your question
 
6:10 AM
instead of downvoting, why not just edit, I accept them..., want more comments, add it, instead of asking to write it this and that...
 
What is right and what is wrong. I it ok for me to stay up so late? Oh the quandary.
 
Comments are part of the process to improve questions and answers, not just edits.
 
for me, it's was completely clear from beginning, no need for anything more
it's so trivial
 
That answer makes me extremely happy that we can down vote people in to oblivion.
 
I've voted to reopen your question, since you've added the requested information. However, I'm not sure why you see the need to add the antagonistic flavor to your question. Is an explanation of your problem in English such an offensive thing to ask? Does it not make your problem more understandable? — Benjamin Lindley 4 mins ago
 
6:17 AM
I think if it were me, I would just delete the question and start over.
 
@chico ^ Do you realise that people have no incentive to help you with your questions other than their goodwill? So when Benjamin or anyone else leaves comments to help you if you react like the way you did that goodwill runs out quickly.
 
for me, not, I've seen some many spaghetti code in stackoverflow that gets analysed and answered, then I came with 5 obvious lines and get this
 
Forget the others, this is about you.
 
I still don't know what the question is, to point a fact.
I may be incompetent, but still.
 
I'm tired of stackoverflow and its rep whores, will keep with IRC and bug reports, I find much more serious people there then here, see ya. That thing about "I deleted my comments on your question because I don't want to be associated with it in any way." ... is so... well, I can even express
 
6:24 AM
Good luck.
 
6:38 AM
@chico you where asked for me information, and then acted like a smug twat about it, what do you expect? people to bend over and kiss your ass? Get over yourself.
@JerryCoffin what would be the point? as soon as the power is cut, the stepper motors have zero torque and thus the joints can freely turn.
he he he, cats don't like having menthol breath blown in their faces :P
 
@chico so, because it's obvious to you, there's no need to explain it in detail to others who are trying to answer your question?
 
Links?
I want to throw a stone, too!
 
1 hour ago, by Luc Danton
What the fuck is happening here? When did become infested with dicks? See behaviour of OP, some commenters, and one 'answerer'.
 
@chico Go ahead and file a bug report with the same wording and see if that gets treated any better. Hint: the problem is with your attitude, treating those you need help from like shit. Doing that in a bug report won't make you many friends either
 
Heh.
I agree, the tone of the question is stupid. You got what you deserved.
 
6:51 AM
I don't understand how they can not understand this.
 
Heh @wilx, thought your name looked familiar... your question was quite helpful to me a few hours ago :)
I still don't understand the memory orders, but at least I got the refcounting going.
 
\o/
@chico: Ask the same question anew with friendlier tone. You might get an answer.
@chico: TBH, this looks like a Clang bug. I would have already reported it to Clang bug tracker instead of SO.
 
7:12 AM
Woo, made my tests actually check that stuff works and it does.
 
7:40 AM
I've found where @sbi hsd hidding himself. (not the most SFW link in the world)
 
lol
 
7:58 AM
@StackedCrooked I saw a nice one summing up what that meme has been reduced to "Wiped on ass!"
 
Not sure if you've seen: meta.stackoverflow.com/a/182572/153020 but I'm quite keen on it for older but useful questions - it's "experimental" at the moment.
 
@DeadMG I've started adding 'stock' source/sink ranges, and I've found that interval is a fitting name for what I think you call Delimited. I like the name enough to give you a heads-up.
 
@Flexo :|
Better than deleting I guess?
 
8:58 AM
@Rapptz yep and it leaves them editable
which is even better
 
9:21 AM
Inline namespaces are used for ABI versioning, but this is pretty useless
 
9:38 AM
The weird thing is that my example is how Stroustrup teaches to use namespaces in The C++ Programming Language
But I've never seen it in practice.
Even boost doesn't do this.
Or std.
 
well, normally you wouldn't use a namespace just for one function, as your code would normally be more then just one function, unless you really suck at code
hm, time to start look at dependency managment for my build system :P
 
20
Q: Unmangling the result of std::type_info::name

terminusI'm currently working on some logging code that supposed to - among other things - print information about the calling function. This should be relatively easy, standard C++ has a type_info class. This contains the name of the typeid'd class/function/etc. but it's mangled. It's not very usefull. ...

What is unmangling?
I don't get it
 
just encase I am barking up the wrong tree, basically going to look at a file I want to compile, and search through it for all the '#includes' (recursing as I go) and build up a list of files until I find one that has a last modified date newer then that .o file that I would compile... then I know that I need to compile this file... not quite as simple as it sounds... but more or less it?
 
9:54 AM
@thecoshman aye
I will try to keep your advise in mind.
:D
 
@StackedCrooked o_0 I wouldn't keep my own advice in mind :P
 
@thecoshman Run gcc -MD
 
4
Q: Why is namespace composition so rarely used?

StackedCrookedIn his book The C++ Programming Language, Stroustrup teaches to define individual components in their own namespace and import them in a general namespace. For example: namespace array_api { struct array {}; void print(const array&) { TRACE } } namespace list_api { struct l...

Probably not gonna be very enlightening..
 
@CatPlusPlus what that do?
 
Just looking at includes is not enough because: different search paths for "" and <>, #include MACRO, #include within conditional block
 
9:56 AM
But who knows, a wizard might come along.
 
Also you don't want to depend on system files
 
@Tuntuni thx
 
Basically use ninja
And depfiles
 
@StackedCrooked We have different components in different namespaces at work
 
@StackedCrooked What does that buy you
 
9:58 AM
@CatPlusPlus not your sympathy
2
 
C++ has manual namespacing, so not like you need to split namespaces to keep files manageable
 
@CatPlusPlus using another 'finished' solution sort of defeats the idea of playing around with making your own
 
I'm doing meta buildsystem on top of Ninja
There's little room to innovate in the build engine itself, it's just busywork
 
Oh, GCC 4.8.1 release.
 
it's not really a case of trying to innovate, more just wanting to play around with something. And it is actually helping me get a much better understanding of the magic that I never really paid much attention to.
 
10:03 AM
> Where other build systems are high-level languages, Ninja aims to be an assembler.
 
@thecoshman Yeah... you really want to be using GCC or Clang to implement this functionality.
 
Well, you could implement a C++ preprocessor in your build system and keep paths in sync and it should be okay-ish
But why are you doing this to yourself
(Plus you don't need to prescan for implicit dependencies, you only need them for incremental builds)
(So slapping -MD and keeping generated depfile around is the best way to go)
 
and my lord do I need to sort out a new computer, this thing is starting to get confused just using a damn browser.
Might be the latest Nvidia drivers actually...
either way
so this -MD, I just stick that into the command for compiling, and it will automatically work out if it really needs to compile for me? SWEET
 
No
It will generate a file with all implicit dependencies
Actually you probably want -MMD
 
yeah just saw that one
and then if they do update system libraries, they just have to manually do a clean build
will have to play with this and see what it gives me
 
10:16 AM
It's not something you have to worry about in incremental builds
You can safely assume system-level dependencies don't change from build to build, because if you didn't, you'd have a fuckload more files to check
And it takes time
And you want incremental builds to be as fast as possible
 
yeah
it's not like it hard to just say 'oh, I've updated this system library, full build'
 
If someone is too dumb to realise they should do full rebuild after updating system libs, their problem really
 
someday I will have to enable incremental rebuilds with Wide
 
10:37 AM
hmm... am I misreading the docs, but if I use GCC -MMD -MF foo/bar.cpp it will compile the source to ./bar.cpp as normal, but also generate a dependency file ./bar.d... right?
or for that behaviour, is -MF and the resulting output file for taht info all implied?
 
I got her
squeeeee
 
oh, guitar :P
 
Xeo
Mornin
 
ah fuck this, I'm going to spend me some money :D
new PC a hoy!
 
lol
 
10:41 AM
would anyone care to give some final feedback on my line up before I cough up the money?
here be my list of shiny things
@thecoshman learn to spell god damn you!
 
Xeo
@LucDanton Would decay be what decay_copy in the standard is?
 
Ye.
 
Xeo
kk
Because I found decay_copy to be a bit of a misnomer
Since it may also move
 
@thecoshman Did you check benchmarks on the CPU and GPU
 
copy and move are poor names. That they double up as algorithms is another argument.
 
10:47 AM
@DeadMG nah, it'll be grand :P probably should though :P
 
@thecoshman You really should.
 
@thecoshman -MF sets the output filename
So you want gcc -MMD -MF out/foo/bar.d -o out/foo/bar.o foo/bar.cpp or something like that
 
@CatPlusPlus ah I see
 
Xeo
Also, GCC / libstdc++ doesn't like struct X{ void f()&& {} }; static_assert(std::is_member_function_pointer<decltype(&X::f)>(), "..."); :/
 
That's fixed. Well, the front-end issue is. I haven't kept up with libstdc++ though.
 
Xeo
10:53 AM
Oh, cool
 
Main() {
    x := Standard.Containers.Pair(int, int);
    y := Standard.Containers.Pair(5, 5);
}
fuck you, make_x.
 
Xeo
Ah, yeah, the function definition itself works fine.
It's the trait that fails
 
@DeadMG Heh, I'm kinda on the fence about using my own annex::tuple(0, '1', "two").
 
Xeo
Foo(a, b) { return Pair(a, b); } // is this a type constructor? Or object constructor? Or both?
 
from what I can gather with the GPU, it is by no means a beast mode card, but considering the price range I am looking at seems very good... CPU reviews now
 
10:56 AM
@Xeo Whether a and b are types or not is kinda important information to have.
 
Xeo
So it can be both?
 
of course
there's nothing magic about Pair in this context
it's just overload resolution.
one overload is specified to take types, and the other isn't
 
@Xeo Writing such a mem_fn is probably one of the earliest thing I've made. I think an additional overload would be a perfectly cromulent addition.
 
Xeo
@LucDanton I don't think it fits for mem_fn to do the binding
 
@LucDanton I think the same argument holds for function pointers, namely that bind should be smart enough to add the extra placeholders.
 
10:58 AM
Well you can name it delegate or whatevs but I don't see a major benefit.
 
Xeo
easy_bind~
 
@DeadMG Obviously that one should be handled by fn!
 
lol
 

« first day (959 days earlier)      last day (3998 days later) »