« first day (181 days earlier)      last day (4759 days later) » 

10:02 PM
That did have some good points though. When Windows 1.0 came out, we were getting programming support long before the first Windows SDK. The last time I moved they got lost, but for years I had some photocopies of hand-written notes by the guys who did most of the original Windows code.
 
10:30 PM
wow
and suddenly I feel better
 
@DeadMG :)
 
I was very sick for several hours
I leant out a window for ten minutes and I suddenly am on top of the world
 
@DeadMG Lately I get stomach cramps every time I eat fish. It know it can make you feel really miserable and unable to focus on anything else.
 
don't eat fish
:P
honestly, I bitch all the time about my stomach problems in this chatroom, I'm gonna go be happy now
 
@DeadMG Indeed. But it took a few tries to convince me of this. In the past I never had any problems eating fish.
 
10:36 PM
yeah
the trouble for me is that the problems aren't rapid so I don't get the defensive associations with pain
so when distracted I can easily eat something wrong
 
@DeadMG the punishment comes later, aarg
 
I noticed
 
Does anyone know if installing two applications at the same time (Qt framework and Windows Update) will cause the files of both applications to be interleaved on disk resulting in worse performance?
 
Xeo
template<typename ITER>
bool nextPermutation(ITER start, ITER end)
{
    return nextPermutation(start, end, std::iterator_traits<ITER>::iterator_category());
}
why doesn't the above code need typename before the iterator traits?
 
10:52 PM
because the result is not a type
 
@Xeo Why would the compiler think of std::iterator_traits<T> as anything else than a type?
I don't see any ambiguity.
 
Xeo
@StackedCrooked the typename should be needed for the iterator_category typedef
 
it's not a typedef
you call it with operator()
 
Xeo
typedef random_access_iterator_tag iterator_category;
in the iterator_traits struct
 
this basically means that iterator_category must be a function or a type
and cannot be, say, an integral constrant
 
Xeo
10:54 PM
and that tag is a simple struct
 
constant, not constrant
 
Xeo
and that () is just a call to the default constructor afaik
 
con 1
 
Damn.. VMWare Fusion + Mac OS X Spaces => Really nice...
 
11:03 PM
Someone said to type def so I did.
It's the first time I've followed instructions all day.
 
lol
 
Xeo
okay, now that typename thing gets funny
 
sbi
13
Q: Where and why do I have to put "template" and "typename" on dependent names?

MSaltersIn templates, where and why do I have to put typename and template on dependent names? What exactly are dependent names anyway? I have the following code: template <typename T, typename Tail> // Tail will be a UnionNode too. struct UnionNode : public Tail { // ... template<typen...

 
Xeo
@sbi: Doesn't answer my question, as I know I need to put it there. :) I'm just wondering why VS2010 lets me leave it out just fine
 
sbi
@Xeo Well, you asked "why does std::iterator_traits<ITER>::iterator_category need a typename in front of std::iterator_traits", no?
 
Xeo
11:12 PM
@sbi: "why doesn't the above code need typename before the iterator traits?" :P
using visual studio 2010
 
sbi
@Xeo Oh. Sorry.
 
@Xeo Visual C++ will compile some incorrect code.
 
Because Visual Studio parses templates incorrectly.
 
it's not because VC is incorrect
 
sbi
I see two possible reasons: 1) VS is right, and std::iterator_traits<ITER>::iterator_category() can't be anything but the creation of an object of a type (unlikely), and 2) even VS10 still doesn't fully support two-phase lookup and therefore gets this wrong (likely).
 
11:14 PM
it's because he adds (), and it can only be a function call, even if that function call is a constructor
and function calls do not return types
 
Xeo
@DeadMG well, gcc fails on this
 
therefore it shouldn't require typename
@Xeo: That doesn't mean that VC is wrong by default
GCC can be wrong too
 
sbi
@DeadMG Well, with a<b>::c, c might be the name of a function or a function pointer.
 
either way, it most definitely does not produce a type
 
sbi
Anyway, as you all know, I never read the standard (can't stand its meter), so I'm definitely the wrong person to judge this.
 
11:15 PM
you cannot perform any operation ending in () which produces a type
as they all occur at run-time
 
sbi
@DeadMG But it does. std::iterator_traits<ITER>::iterator_category is a type.
 
()
 
sbi
The () is performed on the type.
 
that doesn't matter
it matters that it cannot be a constant integral, for example
 
@DeadMG What position are you siding on? That it could get by without typename?
 
11:17 PM
if you have an expression ending in (), you know that it's a function call- even if you don't know the function involved
yes, I think that it should not require typename
 
int() is not a function call.
 
sure it is
it calls int::int()
 
Xeo
0
Q: Why is typename _not_ needed here in Visual Studio 2008/2010?

XeoIn this question, the asker has the following function: template<typename ITER> bool nextPermutation(ITER start, ITER end) { return nextPermutation(start, end, std::iterator_traits<ITER>::iterator_category()); } Why isn't a typename needed before the std::iterator_traits? I tho...

answer and get your rep while it's hot :P
 
hey, I can't get rep if you just link to my chat messages
2
 
@DeadMG int is not a class or namespace, you cannot use the scope-resolution operator on it. There is no int::int().
 
11:19 PM
@GMan: There is for the purposes of templates
 
Xeo
@DeadMG Oh, sorry. :>
 
just like there is no int::~int(), but it's still legal to explicitly destruct it that way
 
@DeadMG No. There simply is no int::int(), not with or without templates, ever.
@DeadMG Yes, as a special-case in the language.
Nothing to do with templates.
 
it exists because of templates
because if you do T t = T::T();, then this should be valid for any default-constructible type- including int
 
No. The expression is called a pseudo-destructor-call. Pseudo is there for a reason.
 
11:21 PM
Yes, like in Pseudoku.
 
@DeadMG This code is not valid:
template <typename T>
void foo()
{
    T t = T::T();
}

int main()
{
    foo<int>();
}
 
Xeo
@JamesMcNellis you just made me read sudoku
 
actually, nor is it valid for std::vector<int>
I keep forgetting that constructors in C++ are special cases
 
Going back to typename, it's required because it needs to know if a<b>::c() is value-initialization of the type a<b>::c, or if it's a function call for the function a<b>::c
 
you can, however, do
template<typename T> void func() {
	auto x = T();
}
for any T, including int
 
11:25 PM
Yes.
That doesn't mean T() is a function call, or that int has a constructor.
 
I'm pretty sure that constructors are functions
special cases, admittedly, but they are still functions
 
Constructors are functions, but they have no name. You cannot call them.
 
if you have a<b>::c(), then you know it's a function call- even if that function is a constructor
 
No! You cannot call constructors. int() is not a function call.
 
it calls the default constructor
 
11:28 PM
No, it value-initializes the object.
int has no constructor.
If it did, int i; would initialize i to 0.
 
sbi
And now for something completely different:
 
which is a function
 
sbi
Freedom of speech isn't something somebody else gives you. That's something you give to yourself.
 
just not a normal one
 
> A qualified-id that refers to a type and in which the nested-name-specifier depends on a template-parameter shall be prefixed by the keyword typename to indicate that the qualified-id denotes a type.
 
Xeo
11:29 PM
@DeadGM, you can now also debate with @Johannes about that () being a function call. :)
 
the result of the expression a<b>::c() can never denote a type
 
sbi
(There was a time I - and others here - would jump on anyone trying to lead a serious C++ discussion. Unfortunately, that time is gone. <pouts/> )
 
@DeadMG Right.
 
only an object
 
But that's not a single token.
 
11:30 PM
@sbi We are exercising the free speech we have given ourselves ;-)
 
It's a<b>::c followed by ().
 
sbi
@JamesMcNellis :)
 
The question isn't whether or not the whole thing gives us an object, it's whether the compiler should value-initialize a type or call a function.
 
Xeo
@sbi wut?
 
no, you're missing my point
 
11:31 PM
Like it or not, these are two different things. You cannot call constructors; T() is never a function call when T is a type.
 
neither of those operations yields a type
 
sbi
@Xeo Well, mentioning he disagrees with someone basically stops all discussion. ("a humanoid robot from the future that tries to disguise itself as a German citizen")
 
Xeo
@DeadMG the typename isn't for the operation, but for whatever is behind that iterator_category<ITER>'s ::
 
doesn't matter
 
11:32 PM
@DeadMG The compiler has to parse a language grammar. This means determining if a<b>::c is a type, or a function, or anything else. You're right, given () we know it's either a type or a function, but we have no idea which of those. This ambiguity must be resolved, and we do that with typename.
 
@sbi Ha ha ha I missed that one!
 
sbi
@Xeo There was a time where, whenever some serious C++ discussion dared to raise its ugly head here, someone jumped on it and brought up nicer subjects, like, er, um, uh, sex?
 
typename is only needed for denoting an expression which yields a type
a<b>::c() does not denote a type
 
Xeo
How about the opposite direction?
Singletons, anyone? :D
 
therefore, you don't need it
 
11:33 PM
...................
I give up.
 
sbi
@DeadMG Did I mention a<b>::c yields a type?
 
@DeadMG You do need it because of the text I cited above.
 
@DeadMG Let me ask you this: if you're a compiler, what code do you generate for x()?
(Feel free to ask clarifying questions.)
 
@GMan 1000111101011101001010100100010010101010000101011010101111
 
sbi
@GMan That depends on what x is.
 
11:34 PM
personally, I'd generate a function call, which I would then choose to inline if appropriate
 
@sbi Exactly.
@DeadMG You didn't ask what x was. x is a type. You cannot "call" a type.
 
Xeo
@JamesMcNellis those are 59 digits, that cannot be right
 
sbi
@GMan (As a nice citizen, I knew exactly what was expected of me.)
 
@JamesMcNellis lol
 
hmmmm
it's syntactically the same; it behaves like a function and even involves the calling of a function
sounds like a function call to me
 
sbi
11:36 PM
@Xeo It's his pet peeve machine, the one he created from his old bicycle's remains. It runs on 59bit - sometimes.
 
@DeadMG Don't jump ahead. I ask again: what code do you generate for x(), when x is a type?
 
a function call to x's default constructor
 
(I'll even give you that we can call x() a "function call" to x's constructor, even though that's not how it really is.)
 
sbi
@DeadMG I really don't know why you're doing that. Even I know that, it x is a type, then x() is not (not, not, not) a function call, but the invocation of a ctor. And did I mention I don't even read the standard?
 
@DeadMG Okay, given my note above, that's fine. x() is a call to the default constructor for x. Now in a difference scenario, x is a function. What code do you generate?
 
11:37 PM
a function call to operator()()
 
@sbi I already argued that with him, but it's not relevant to the point on typename so I'm putting it aside.
 
evening all!
 
sbi
@Tony Don't be so pretentious. It's morning for you and me.
 
and me to
 
Xeo
That reminds me of a story and an idea for coders that followed it.
The story was, that somebody wrote a book on his mobile phone when he was waiting during traffic jam (saving the text in SMS)
the idea was, to build a bike with 8 buttons on the handlebar, each standing for one bit in an byte and coding a programm while touring around the world with that bike
 
11:38 PM
tii]
 
@DeadMG Right, you call the function. Now do we agree these require two difference courses of action? In one case, you (the compiler), have to locate the x constructor function to call, and in the other you just need to call the function?
 
too, goddamnit
 
@sbi haha, yea if you're a night person just like me
 
sbi
@GMan Don't be so ridiculously patient! I can't stand watching that!
 
@GMan: In the second case, you still have to locate the function
 
Xeo
11:39 PM
@sbi More like night...
 
@DeadMG Not if x is a function, like int x();.
 
ok
 
@sbi did you manage to then finish fixing that bug you were working on earlier?
 
so how come I have to locate constructors, but not any other functions?
 
sbi
@Tony I used to be. Now, having had small kids for almost 15 years, that changed.
 
11:40 PM
@DeadMG Because if x is a function(-pointer) type, you already have the function address. With a constructor, you need to have the help of the linker, for the most part. (You have to look up the function.)
 
@sbi oh ok, I can how that would be
 
no, not really
if it's inline, then I can inline it, else, I need the linker's help
that's true regardless of if it's a constructor or not
 
I mean to locate the symbol, not to optimize.
And I said for the most part, it could be present. The main point is you have indirection to take care of.
 
sbi
@Tony The one I hoped I fixed this morning didn't dare to come up again for twelve hours, despite me starting the tests all the time, even if no changes were checked in. So I suppose I really fixed it. The other one, the one where I added a new type to the system, still wreaks havoc left and right, making a third of the unit tests fail. :(
 
yes, but so what? you know just as much about the types involved when dealing with all function calls that you make- regardless of whether they're dynamically dispatched, inlined, or statically linked
 
11:43 PM
@DeadMG Don't jump ahead! :) So we agree the compiler has to do different things, depending on what x is?
 
sure- if you're a function pointer, it needs dynamic dispatch, and if you're an inline function, you need inline heuristics and such running
 
Huh? Where is dynamic dispatch and inlining coming into this?
 
if x is an inline function
then it needs to be inlined where called
 
The cases were it's either a function or a type.
 
and if x is a function pointer, it needs to be dynamically dispatched
right
 
sbi
11:44 PM
I'm as good as the robot from the future!
 
@DeadMG Now, as the compiler, you have to prepare to either look up x as a function, or as a type, right?
 
@sbi I suppose this is a far more complicated system then I can imagine, so I guess I won't even try to say anything about how that can be possible that one type can wreak so much havoc
 
(To know whether to call a constructor, or do something else function-like.)
 
no, I disagree
 
sbi
@Tony It's a workflow system that objects are sent though. I added a new type of control object. It's supposed to change everything. But I'm supposed to make the system work with the object...
 
11:46 PM
@DeadMG Why? We just established there are two different actions to take.
 
because neither of them affects the system, from the perspective of what static inforrmation the compiler has
 
Xeo
@sbi Well, if it wreaks havoc left and right, I assume it did its job to change everything. :)
 
when it comes to actually find and emit the assembly for the call, then you probably do
but if you're performing static analysis, then it's not important, because you know that x() can only return an object, or void
as an expression
regardless of what x is
 
@DeadMG ? What? Okay, put another way: the compiler generates different code depending on if x is a type or a function, yes?
 
@sbi so is there then no specs on the interface of the object that you can put through, or do you literally have to brute force a new type that it hasn't worked with before through?
 
11:48 PM
yes
or indeed, an inline function
 
Okay, that's all that matters. So again, when generating this code, we have to look up whether x is a function or type, right?
 
sbi
@GMan To be frank, I find you explanations unconvincing, to say the least. Whether x in x() is a type is known at compile-time, and so the compiler knows it's a constructor call at compile-time. And it also knows at compile-time, which ctor it is supposed to be calling, so it won't need the linker.
 
no, wait
 
sbi
Nevertheless, if x is a type, x() will not call a function, but invoke a ctor.
 
@sbi neat, that template stuff is still somewhat over my head, but I'm always learning
 
11:49 PM
@sbi I'm not sure why that's relevant to my direction.
We're talking about typename.
 
sbi
@Xeo Well, "wreaking havoc left and right" isn't the only way to implement "change". Unfortunately, this one time we need the other one...
 
ok, when you come to emit the assembler, then you do need to know
@sbi: what, "wreaking havoc left, but leaving the right untouched?"
 
@DeadMG Yes. Now I don't know how much you know about compiler theory, but you don't go straight from C++ code to assembly, you have to store it in an intermediate form. Can we agree to that?
 
@DeadMG thnk god we don't have to emit assembler anymore, or not often anyways :)
 
@sbi "wreaking havoc up and down"?
 
11:50 PM
yes
 
sbi
@Tony The object is fine, all according to the spec. The way the system deals with its kind is flawed. :(
 
I know the basics of compiler theory, only ever written Brainfuck interpreters and such in practice
 
@sbi hmmm
 
Okay. So when generating this intermediate form (aka compiling the translation unit), we need to know if x is a function or a type, so we can either do our function calling code, or our constructor calling code (which has a common subset, yes, but the type case requires a different course of action nonetheless).
 
@DeadMG really brainfuck interpreters?? you need to be an interpreter just to read that language
 
sbi
11:52 PM
@GMan You were saying, so much further up that I can't be bothered to search for a link just to prove it to you, that a ctor call is fundamentally different because the compiler needs the linker's help in order to find what to call. I find that unconvincing.
 
@Tony: Writing a Brainfuck interpreter is trivial -writing Brainfuck is hard
@sbi: constructors can be inline too
 
@sbi That was a reactionary statement, trying to find a way to get the two to be difference courses of action.
 
@GMan: I disagree
 
What....Dead, we just spend 5 minutes taking steps towards that.
 
11:53 PM
that difference comes when you come to compile the IL to machine code, not when you're writing the IL
 
Johannes, take over. I quit.
 
Ah ha! The humanoid robot laughs!
 
@DeadMG oh ok
 
BTW clang has the broken MSVC++ late parsing template mode as an extension: mail-archive.com/cfe-commits@cs.uiuc.edu/msg32897.html
 
@JohannesSchaublitb reading your typename explanation. :)
 
sbi
11:55 PM
@MartinhoFernandes Whatever you want to call it. I slowly and painfully went from 60% of all tests fail spectacularly and 30% fail just so, to 60% pass. It's cost me a year of my life to do that today, and around 10pm I had to stop working, because my brain felt fluffy.
 
@JohannesSchaublitb I believe EDG may as well; I know that Intel C++ has a /emulatemicrosoftbugs flag or something like that.
 
the @sbi linked to in that last question he answered
 
@DeadMG No. The compiler needs to know whether or not x() is a function call or value-initialization. The two are different, x is not the name of a function when x is a type, end of story, read the standard. Ergo it needs to know if a<b>::c denotes a function or type so it can do the right thing; they are not the same. So you tell it with typename. That's it.
 
@sbi wow programming can make your brain go fluffy... that's a new side effect i have yet to experience :)
 
sbi
@Tony parse error #471142, bailing out.
 
11:57 PM
@JamesMcNellis my colleagues switched that flag on :( i'm always annoyed when at theend of the day i say "ahh fine. everything compiles!" only to find out all the templates have all these silly typos in them when I actually call them
 
Yes, x could be designed to be a function name when x is a function, but that doesn't make sense either because constructors do not return values, you cannot call them, they are used by the compiler to initialize.
 
@sbi sorry typo, I was referring to the link you posted earlier
 
sbi
@GMan void f() doesn't return a value either. (Just pointing out...)
 
in there you hyperlinked an answer of Johannes and that's what I'm reading
 
@JohannesSchaublitb On my last team I changed our global project properties to use /W4. Months later I discovered that several of my colleagues had gone through and changed a bunch of individual projects to override that and use /W1.
 
sbi
11:58 PM
@GMan Didn't you say you'd quit?
 
@sbi I'm bad at it.
 
lol @JamesMcNellis
 

« first day (181 days earlier)      last day (4759 days later) »