« first day (664 days earlier)      last day (4299 days later) » 

4:00 PM
No.
 
@VinayakGarg it means that (the/some) iterator is invalid and cannot be used.
 
@VinayakGarg ...any previously stored iterator becomes incorrect (unusable).
 
Okay!
 
@MooingDuck Yeah, they gimped it in an irritating way.
 
@MooingDuck I started writing the operator function like that. But g++ was complaining a lot. I didn't write the ... part correctly.
 
4:03 PM
@VinayakGarg well, you have to write code correctly for it to work.
 
@MooingDuck Yup. I will just read about it.
 
@VinayakGarg bool Person::operator<(const Person& rhs) const {return name<rhs.name;}
 
@BartekBanachewicz yup /cc @ApprenticeHacker
 
Just to be exact, it would be
if (firstname==rhs.firstname) return lastname < rhs.lastname;
else return firstname<rhs.firstname;
 
Anyone playing World of Tanks? I'm really bad at this game.
 
4:08 PM
@VinayakGarg I wasn't sure what he was sorting by, I'm making stuff up
 
But hey, tanks.
 
@VinayakGarg I've never seen a predicate defined like that, that's interesting. I'm still deciding if I dislike that or am doing that for now on for multiple predicates.
 
@CatPlusPlus I've heard that it's very "Play for free, pay to win"
 
@MooingDuck Haha even I have never seen/written this before.
 
Quiz question: If I wanted to change all the names of member variables in a project (a big project) to m_* if they weren't already named that way, would it be a massive pain or easily achievable? Any tools exist?
 
4:09 PM
@VinayakGarg std::tie(firstname, lastname) < std::tie(rhs.firstname, rhs.lastname) nets you lexicographical ordering for free.
 
@MooingDuck It's a simple prioritized operator. Much like you'd get from std::tie.
 
@LucDanton There is so much to learn!
 
@VinayakGarg I suppose if you don't care that much for C++ you can write the ordering yourself -- in this case what you're doing is not the usual way.
I.e. that std::tie thing requires knowing a bit about some parts of the C++ language library. Useful parts though.
 
@DeadMG I've never seen a generic prioritized operator that I was really happy with. Namely, when comparing strings, they all iterate two or three times. (premature optimization)
 
@LucDanton Indeed useful! Had i known the stuff mentioned here, I could have coded early and nicely.
 
4:14 PM
@MooingDuck Twice is necessary in the general case.
 
@VinayakGarg So for the record std::tie comes from the tuples part of the Standard library -- we're using the fact that std::tuple<A, B, C> has a lexicographical ordering (iff A, B and C have orderings themselves).
 
@DeadMG in the general case yes, but maybe there should be a thing that checks for int T::compare(const T&), and only uses operator< and operator== as a fallback?
 
std::tie is a shorthand way to obtain a tuple view of some variables.
 
@LucDanton Tuples are a C++11 feature? I couldn't have used it.
 
@MooingDuck No. Even if such a thing did exist, I don't see how you could avoid iterating twice.
@VinayakGarg Boost, too.
 
4:17 PM
@VinayakGarg Yes, C++11. There are also tuples in TR1.
Wait, are there? I'm not so sure.
 
@LucDanton Most libs that went from Boost to C++11 went through TR1 first.
 
There are. I'm surprised, what with no variadic templates.
 
bool is_less_than(const T& lhs, const T& rhs) {
    int r = lhs.compare(rhs); //one iteration
    if (r!=0) return r<0;
    return false;
}
 
@MooingDuck It's not one iteration, it's two. Those two are just hidden in the implementation of compare.
 
@LucDanton those boost guys are crafty
@DeadMG I rather think string::compare only does one iteration.
 
4:19 PM
@MooingDuck I don't mind Boost emulating variadic templates. It's putting it in TR1 that surprises me.
 
@LucDanton Happened with std::function too.
@MooingDuck But it calls both operator== and operator<.
 
@DeadMG what sort of insane idiot would code it like that?
 
@MooingDuck What other implementation is there?
and don't forget all that glorious Unicode normalization and collation
 
string::compare(const string& rhs) {
    for(auto lit=m_begin, rit=rhs.m_begin; lit!=m_end && rit!=rhs.m_end; ++lit, ++rit) {
        int r = traits::compare(*lit, *rit);
        if (r != 0) return r;
    }
    if (lit!=m_end) return -1;
    if (rit!=rhs.m_end) return 1;
    return 0;
}
 
4:25 PM
@DeadMG std::string can't handle unicode normalization anyway, but a similar strategy exists.
 
@MooingDuck All you've done is delegate to traits::compare.
 
@DeadMG that's how std::string::compare is defined
@DeadMG and traits::compare only compares one character at a time, still guarantees one and only one iteration.
 
@MooingDuck Not helpful if you're doing twice as many operations per character.
 
@DeadMG is it really more operations? It might be, but it's not obvious to me.
 
@MooingDuck Simply consider the implementation of traits::compare.
 
4:28 PM
@VinayakGarg ideone.com/t4Sox This is ugly, dirty, and some commands don't work
 
I think I have found the very definition of this lounge
Group intellectual masturbation.
 
@DeadMG I believe the default implementation is somehting like `int traits::compare(char lhs, char rhs) {return int(lhs)-rhs;}
 
but I'm too lazy to continue.
 
@TonyTheLion Circle jerking.
 
lol
yes, here we have an educated man :) :P
 
4:30 PM
@MooingDuck Widening is gonna suck there, and in addition, you're gonna have fun with UTF-8.
 
@kbok Wow! you really did that fast! Let me go through it carefully.
 
@DeadMG I'm not talking theory, I'm talking about how the C++ spec has defined those things
 
@MooingDuck Well, it's really quite irrelevant if it can't be made to work with Unicode.
 
@VinayakGarg The filters don't work, and there is no error handling.
 
4:31 PM
@DeadMG you just said that std::string is irrelevant?
 
You're discussing the Unicodes without me!
goes back to debugging.
 
@DeadMG oh hey, I was wrong. traits::compare's signature is int compare(const char_type* s1, const char_type* s2, size_t n);
so that could handle more situations than I thought it could
 
@MooingDuck I'm saying that your proposed change is an extreme micro-optimization that wouldn't lead to any real performance benefit, and even if it did, it would only be in a niche.
 
@kbok For so little time, I think it is good enough
 
4:34 PM
@DeadMG no, you've merely shown that it might not provide much performance for std::string
 
... aaaand pretty much everyone uses a Unicode string for applications that actually require significant text.
 
Looking at the star board, I see that @kbok is on fire.
 
Undefined Behavior can lead to *anything*, including everything working fine, crashes, and programmers refusing to work on Friday afternoon.
</shameless self-promotion>
 
lol, ah so I can blame my procrastination on UB
nice :)
 
@TonyTheLion Not you, no.
I can, however.
 
4:36 PM
why can you, and not me?
 
@TonyTheLion Because you're TOOOOONNNNYYYYY THHEEEEEEE LIIIIIOOOONNNN.
 
LAWL
ok, going out for dinner
laters
 
@DeadMG do you feel like looking at my code again, and listing the horrible atrocities I committed?
or have I used up your patience :)
 
feel free to post it
 
4:37 PM
@melak47 Give him food, that'll work.
 
aaaaaah
 
uh-oh
 
why, in the name of God, would you use typedef enum {} ... awful?
that shit was never necessary in C++
 
to be consistent with the D3D stuff :p
 
4:39 PM
Hey guys, anybody free to help with libcurl and C++
 
user1182183
hey does anyone know where the SVN config file is on google code? I tried to upload a file called 'config' into the root directory of the SVN and into the /.subversion/ directory but it's not being applied, or at least the HTML pages don't show
 
@melak47 to be consistent with C? Don't do that.
 
@melak47 Murder it.
 
@DeadMG done :)
 
user1182183
@melak47 shift+delete?
 
4:40 PM
now there are a few other problematic failings here
 
@melak47 you had an enum and a typedef with the same name? Does that even work?
 
@MooingDuck Same as struct.
namely
it should not be possible to construct a GPUBuffer without a device and context.
you also failed to implement move semantics for it
 
@DeadMG I always saw them with slightly different names before. These are identical.
 
@MooingDuck Identical is fine.
 
@DeadMG oh
 
4:41 PM
@DeadMG but can I just not have a default constructor?
 
@melak47 Non-default-constructible is absolutely fine.
 
@melak47 it's possible, you just have to be careful about how you put it in containers
 
also, your assign method and constructors need to stop dealing in std::vector<T> and start dealing in iterators.
 
@DeadMG he has iterator overloads. waaaaait
 
@DeadMG well, I made both because it's comfortable to just drop a vector in and it gets the damn iterators itself :/
 
4:42 PM
now
 
but I probably did it wrong :p
 
@melak47 he's saying void assign(typename std::vector<T>::iterator begin, typename std::vector<T>::iterator end) is wrong
 
you really must drop your Create() method.
@MooingDuck Yes. The iterator type must be a template parameters.
 
template<class Iterator>
void assign(Iterator begin, Iterator end) //works on vector iterators, list iterators, deque iterators...
 
and Download/Upload must be private.
and operator& should just die in a fire, that's beyond broken.
and so should mark_dirty, the dirty stuff is an implementation detail.
also you forgot const overloads of many functions
 
4:44 PM
@DeadMG will do once I have the D3DRenderer that can use them
@DeadMG but I need the pointer to the pointer to bind the buffer, and stuff
 
@melak47 operator= should return *this; normally.
 
@melak47 Private functions. Also, you can't gain pointer to the pointer without going through the PointerToPointer struct stuff.
 
@MooingDuck if assign one buffer as another, I'd rather have it assign the data, and subsequently upload that do it's own gpu resource, rather than duplicating the other buffer
@DeadMG but, ID3D11Buffer** is exactly what that struct business returns, and what I get from &gpu_buffer
 
@melak47 Converts to, and it's not valid after the expression ends.
the pointer you get from de-referencing the result is a temporary object.
 
@melak47 I don't know what you said, but I'm talking about std::vector<T>& operator= (std::vector<T>& other)
 
4:48 PM
@MooingDuck yea, if I do gpu_buffer1 = gpu_buffer2; I want that to just assign the cpu_data, it shouldn't make both gpu_buffers use the same gpu resource
 
@melak47 then why didn't you code that?
 
@MooingDuck I suppose that's a valid question
 
std::vector<T> other;
std::vector<T>& r = myGPUBuffer = other;
//how does this make any sense at all?
 
@melak47 The argument should be const and you should mark the destination as dirty.
 
4:50 PM
@MooingDuck I think one character at a time is not feasible for sorting Unicode text.
 
@R.MartinhoFernandes I'd already discovered that was wrong, but you are correct. (I didn't think that std::string could sort unicode text)
 
@CatPlusPlus It's a Steve Yegge post. It's short.
 
Reading anything in that stupid 100px-wide column format is exhausting.
 
@CatPlusPlus CSS the heck out of it?
 
4:52 PM
@DeadMG so, PointerToPointerToUniquePointer<ID3D11Buffer, COMDeleter> operator& ()
{

return &gpu_data;
}
?
 
should be better.
but don't forget that the result is still unusable past &buffer.
 
@CatPlusPlus TL;DR
 
@DeadMG all I need it for is so I can, say, context->IASetVertexBuffers(..., &gpu_buffer);
 
that's fine.
 
4:54 PM
> My thesis: 1) Software engineering has its own political axis, ranging from conservative to liberal.
I won't read it all because seriously it's LONG, but if there should be one rule about engineering in general, it's that there is no such rule
And now this guy is putting all languages on an axis and this should help us think about.. stuff ?
 
@sbi I have seen that. What about it?
> That said, I will admit to the suspicion that PHP is a Commie plot.
2
 
sbi
@R.MartinhoFernandes Oh, I just wanted to point it out to you, since ISTR that you enjoyed the others in the series.
 
@DeadMG about the assignment operator..
 
@R.MartinhoFernandes Now, aren't you being just a little be rude here?
 
5:00 PM
std::vector<T>& operator= (const std::vector<T>& other)
{
cpu_data = other;
return cpu_data;
mark_dirty(); //shouldn't I mark "this" dirty, since this changed?
}
 
@melak47 I pointed this out to you in my list.
 
you said I should mark "other" dirty
 
@sbi Someone mentioned it as possibly containing the answer to a question of mine on the site, so I was already aware of it. But thanks anyway :)
 
@melak47 Then you must have misunderstood- or me mis-stated- I definitely meant to mark "this" dirty.
 
ok
ah, right you said destination. duh
 
5:03 PM
Hmm, now that I look back, it probably contains the answer to two of my questions.
 
also
your mark_dirty() function after return won't mark anything dirty :P
 
lol, yea
 
sbi
Damn.
 
facepalm
@DeadMG can I still keep the enum though, without the typedef?
 
@melak47 Yes. enum X { ... }; is fine.
 
5:06 PM
@melak47 why does buffer = vector return a vector?
 
@MooingDuck I basically want this thing to wrap a vector, and "silently" update the gpu resource with the contents
 
@melak47 you have rvalues in your compiler?
 
I...uhhh..?
 
@melak47 I still think it sohuld return *this;
@melak47 whats your compiler?
 
MSVC11
 
5:08 PM
std::vector<T>& operator= (std::vector<T> other)
{
    cpu_data = std::move(other); //prevents making copy if not needed.
    mark_dirty();
    return cpu_data; //I still disagree about the return type
}
 
@MooingDuck hm well I see what you mean.
 
My compiler is infested with rvalues!
 
@R.MartinhoFernandes Take your flamethrower.
 
I think I actually wanted to write an assignment operator for gpubuffer = gpubuffer, and then it's fine if gpubuffer = vector (of matching type) returns gpubuffer
 
@melak47 I think so too
 
5:16 PM
GPUBuffer<T, bind_flags, cpu_access_flags, misc_flags, usage, purpose>& operator= (const GPUBuffer<T, bind_flags, cpu_access_flags, misc_flags, usage, purpose>& other)
{
cpu_data = std::move(other.cpu_data);
dirty = true;
return *this;
}
 
So many template arguments.
 
yeah :/
 
@melak47 while inside the class you can assume the template arguments.
 
What he said.
 
Aka injected class name.
 
5:16 PM
@melak47 also, you're moving from a const reference. take by copy
GPUBuffer& operator= (GPUBuffer other) {
    cpu_data = std::move(other.cpu_data);
    dirty = true;
    return *this;
}
 
Copy and swap?
 
A move is also fine.
 
@MooingDuck thanks
 
@melak47 wait, are these objects copiable?
 
@MooingDuck not really no
what with the unique_ptr to the D3D resource
 
5:19 PM
@melak47 oh, so if you have GPUBuffer a, b; then a=b makes no sense. alright
GPUBuffer& operator= (GPUBuffer&& other) {
    cpu_data = std::move(other.cpu_data);
    dirty = true;
    return *this;
}
 
@MooingDuck There's no big difference.
 
@R.MartinhoFernandes can't implicitly assign from an lvalue
 
@MooingDuck well I suppose I'd like a=b to do the same as a.assign(b.begin, b.end), i.e. copy the cpu_data vector
 
@MooingDuck Can't with either.
 
@melak47 then make GPUBuffer& operator= (const GPUBuffer& other) do that then
@R.MartinhoFernandes say what now?
 
5:21 PM
@MooingDuck How would the first it assign from an lvalue, if the class is not copyable?
 
@R.MartinhoFernandes guess that makes sense.
 
There's one less move, that's all. (modulo optimisation)
 
@R.MartinhoFernandes but if the assignment only copies the copy-able member?
 
Oh, and technically, the first one is a copy assignment operator that can do moves but no copies, and the second one is a move assignment operator.
 
so, without a default constructor, I guess I can only initialize arrays by doing GPUBuffer<...> array[] = {GPUBuffer<...>(..., ...), ...}; ? that'll be fun with those template arguments :p
 
5:25 PM
@melak47 I feel like that should be explicit, since it's odd.
anyone know if VC11 does vector initializer lists to any extent?
 
nope. doesn't AFAIK.
 
@melak47 I'd make a macro then personally :(
or a typedef! (do a typedef)
 
yeah I suppose I'll typedef common buffer variants
 
mornin'
 
@LuchianGrigore mornin'
 
5:27 PM
@R.MartinhoFernandes find a reference to the debate? :)
 
Hi
 
@DeadMG you said Create() needs to go, should I just paste it into Upload?
 
Xeo
user image
2
 
lol
 
well, I wouldn't just paste anything
 
5:28 PM
@Xeo NSFW?
 
but yes, you need to manage the GPU buffer in Upload
 
Xeo
@kbok Think so?
 
@Xeo It has been proxy-blocked
 
@Xeo His condom appears to be situated such that holding the stick and using the condom would problematic.
 
OK, the build system in Code::Blocks sucks
 
5:29 PM
@DeadMG well that's how it got to upload in the first place, by cut&paste from Upload :p
 
it doesn't understand that a project needs rebuild when its files change
and it doesn't understand transitive project dependencies
and when you do list all dependencies then there's no way to compile just the single project
argh
 
Does C::B actually has anything more to offer than classic IDEs such as Eclipse, VS or good ol' vim+terminal ?
 
@kbok less
 
@Cheersandhth.-Alf Hmm...I wonder if it would be worthwhile to do a "make" that's a bit like Clang -- a library instead of a packaged executable. That way IDEs (and such) that almost all see to get it wrong could use a pre-built library that has at least some chance of doing things right.
 
well it's not Java so less of a performance hog
and it runs in *nix
which is where i use it
 
5:31 PM
@Cheersandhth.-Alf Have you tried KDevelop ? If you have enough RAM it's really great
 
i'm running in Virtual Box
 
@R.MartinhoFernandes I might have bitten more than I can chew. I'm trying to generate the 2^N signature variants (lvalue ref/rvalue ref) of a RemoveReference<Args>... pack.
 
That's a bit short but it may still be worth giving it a try
 
hm, will try... thx!
 
5:33 PM
@Cheersandhth.-Alf np :) let me know what you think
 
whoa, SC2 has a minimum resolution of 1024X720? I haven't been paying enough attention to specs lately
 
1024x720 is a goddamn low minimum res
I'd have gone with 720p myself
 
@DeadMG I think my laptop's resolution is barely higher than that. My older laptop is less than that still.
Then again, I'd never dream of running SC2 on the older laptop.
I think my main laptop is 1400x1000ish, so I think I'm still ahead of the minimum :(
 
Build success, time to go home :) see ya
 
@DeadMG wikipedia says 720p is 1280×720
 
5:37 PM
yeah
everything sold that should be capable of running SC2 from a performance perspective almost certainly has that resolution or higher.
 
#ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP
family desktop app?
 
GG
 
i'm off to dinner for a bit. thanks again @DeadMG and @MooingDuck :)
 
no probs
 
7
Q: Accessing inactive union member - undefined?

Luchian GrigoreI was under the impression that accessing an union member that's not active is undefined behavior, but I can't seem to find a solid reference (other than answers claiming it's UB but without any support from the standard). So, is it undefined behavior?

Anyone want to jump in?
(not fishing for votes, already reached my rep cap for today)
 
5:48 PM
@melak47 at least in norway, "family" about a product is code-word meaning "cheap". most often that means low quality. sometimes it means good value though.
still downloading kdevelop...
oh, it's started the setup!
 
@LuchianGrigore It may be possible to use inactive members in (very) limited ways. I still think any reading would be very contentious though.
 
@LucDanton well, MFC relies on calling non-virtual methods on null pointers, but it's still ub...
 
@LuchianGrigore What does that have to do with anything?
 
@LucDanton I'm asking whether it's UB, not whether it sometimes work or whether you have to be careful or not...
 
kdevelop(5980)/kdevplatform (shell) KDevelop::PluginController::loadPluginInternal: Loading plugin ' "kdevkonsoleview" ' failed, KPluginLoader reported error: '
"No service matching the requirements was found" '
What's that mean?
 
5:53 PM
@LuchianGrigore What I've said stands then. You have your answer.
 
@LucDanton :)) what is it? Is it ub or not?
 
@Cheersandhth.-Alf It means something is wrong :P
 
oops
well it runs
 
@LuchianGrigore Some very limited things are available. Unrestricted unions wouldn't be able to work otherwise.
 
now i have to learn it. nothing that looks like creating a workspace though.
 
5:55 PM
This means that all other things than those things are undefined. By definition. You seem to have trouble with understanding that.
 
@LucDanton I don't even understand whether you're saying if it is or isn't UB, much less your argument...
 
Okay. Consider int* p; then *p isn't defined to work because p doesn't point to anything. However something like p = nullptr is defined to work.
Similarly there are things you can do with an inactive member of a union and some that you can't.
That's the answer.
 
@LucDanton *p is undefined behaviour.
 
Define 'accessing' an inactive member if you want a more specific answer.
You can discount lvalue-to-rvalue conversion for instance.
 
@LucDanton ok. union A { int x; int y}; A a; a.x = 4; a.y;
 
5:58 PM
I don't know the specifics, but I guess accessing means reading from it or writing to it.
 
@LucDanton is the a.y ub?
 
It is UB. Specifically it involves an lvalue-to-rvalue conversion.
 

« first day (664 days earlier)      last day (4299 days later) »