« first day (423 days earlier)      last day (4524 days later) » 

8:00 PM
haha I left off the () around the arguments
but adding it back in didn't
I changed regular function definitions to use { }, I think, to avoid some other ambiguity
nope
still got it
well, Bison sure thinks it's legal to have a literal_expression followed by a {
guess I'll just try to trace that
oh, wait, never mind, I found it
why do I keep unsolving the problems I already solved? :(
 
8:15 PM
0
Q: c++ STL containor stores a class that overloads operator =

user1006322source #include <iostream> #include <vector> #include <string> class A { public: std::string name; int value; A& operator = (const A& from) { value=from.value; return *this; } A(std::string a_name, int a_val) { name=a_name; value=a_val; } }; int main()...

 
type : type { // a type which inherits from "type", or a type which inherits from an anonymous type?
 
the function_argument one should be an ambiguity too
 
I fixed that
 
Make the name of the type type Type. It solves the conflict and is consistent with the rest of your standard library.
 
8:21 PM
well, whether it's a library type or a primitive type is a decision that I keep changing
 
Xeo
@RMartinhoFernandes "type type Type" @_@
 
@Xeo It makes sense!
 
but you're right, it would be unambiguous if I just left it as "identifier"
and I can cut "function" as a keyword, too
 
@Xeo (Make (the name of the (type type)) Type)
 
right
now I'm pretty happy with that
only two S/R conflicts, and they're both fine
 
8:23 PM
But yeah, it was really cool to type "type type Type".
3
 
lol
 
Xeo
@RMartinhoFernandes Shoulda be "the name of the type type Type"
 
now I'm going to celebrate my success with a cookie
 
Xeo
That would make it less ambiguous
 
@Xeo But less fun!
 
8:26 PM
@DeadMG
statements: statement
| statements statement
isn't this left-recursion?
 
sure looks like it
 
case_statements: case_statement
| case_statements case_statement
| case_statements default_statement
 
Xeo
I'm kinda wondering why @DeadMG's language is still called "Wide_C_". I mean, he moves away from the look & feel of C and C++ more and more, now with capitalized keywords and standard library types. Why not just name the language "W", since it's so far ahead of C and C++ anyways?
 
maybe you allow left-recursion
 
it's a LALR(1) grammar
 
8:28 PM
ah okey
 
@Xeo I don't really recall, but I'm not going to change the name for a while
I'm not really happy with the name anyway
 
@jalf Because it's as wide as yo momma.
 
but it'll serve as a placeholder
 
why do you call it "wide" anyway?
 
hell if I know
 
8:29 PM
@DeadMG you dont allow duffs device?
 
i will pay someone 100,000,000,000,000 if they give me a lecture on how to find the last block from an inode number
 
Xeo
Wasn't it because of inherent Unicode support?
 
@JohannesSchaublitb Nope
 
i had figured it'd have 16- or 32-bit chars rather than 8
 
8:29 PM
A hundred billion what? Cookies?
 
good
 
@Xeo Nah. The notion of "wide" characters as in wchar_t is rather C++ specific
 
Xeo
@RMartinhoFernandes RAM
 
your lang is not as expressive then
 
Why the fuck would you want Duff's device?
 
8:30 PM
Duff's Device isn't even faster
 
hundred billion thank you's
 
@JohannesSchaublitb that's an odd definition of "more expressive".
 
Duff's device is about expressiveness?
 
besides
you can explicitly fall through if you want
nothing stopping you
 
How does left-recursion affect performance in an LALR(1) parser?
 
8:31 PM
left-recursion is faster than right-recursion
 
How do you fallthrough? continue?
 
yep
 
Yes, but what if you have neither left or right recursion
 
And do you have anything like Java's trick to get out of nested loops?
 
@ManofOneWay then you're stuck with middle recursion!
 
8:32 PM
I don't currently, but it's on the "to do" pile
 
What if I'm in a loop, and I switch, and I want to continue the loop?
 
@RMartinhoFernandes One trick is to avoid nested loops in favor of higher-order functions.
 
@FredOverflow But now there's no need for nested loops!
 
@RMartinhoFernandes switch has no continue, so there is no problem.
 
ARRGH read the context.
 
8:33 PM
@FredOverflow WideC's switch uses it to fall-through
 
1 min ago, by R. Martinho Fernandes
How do you fallthrough? continue?
 
Well, stop switching back and forth :)
 
not being able to get out of nested loops irritates me too, so I will add it
 
it looks like I didn't miss anything good
 
although right now, I'm more concerned about finalizing this parser and then worrying about having to write an entire fucking Standard library, holy shit
oh, and the decidedly non-trivial semantic analysis phase
 
8:34 PM
Should be standard fucking library, no?
 
lol
 
Please don't use pairs of iterators, or at least provide an abstraction over them.
 
std::traffic ?
 
8:35 PM
@FredOverflow Oh please, I hate iterators to death
 
you can't continue in a switch to rerun it in c++?
 
to what?
I think you're confusing switch with loops.
 
no u cannot
 
Do we even need iterators if we have higher-order functions? Like Scala has a forEach method instead of iterators.
 
have to admit i never cared enough to try it :) but it seems the logical use for the word, if you're gonna have it
 
8:36 PM
@FredOverflow: What do you pass to that method?
 
@TomalakGeretkal A function to be called for every element.
 
A range and a function?
 
@FredOverflow: Every element in what?
 
No, it's a method on a collection.
 
There's your answer.
In case you're still confused, it's "yes, we do".
 
8:36 PM
I had indeed been thinking about ditching iterators entirely, as it were
 
myList.forEach(println);   // or something
 
It provides the flexibility to work with semi-arbitrary ranges rather than containers.
 
@FredOverflow How do you iterate over part of a collection?
 
but sometimes, you do need to point to single elements
 
@RMartinhoFernandes myList.subList(from, to).forEach(whatever);
 
8:37 PM
Cool.
 
And the subList is a copied container?
 
Xeo
@FredOverflow Member functions suck for algorithms, hasn't the STL taught you anything? :s
 
cpx
hmm
 
@TomalakGeretkal No, it's a view.
 
@Xeo: the .. what?
 
8:37 PM
@Xeo I have extension methods, it's no big deal.
 
@FredOverflow: OK, so an abstraction over iterators. :)
I don't see a big difference between .subList(from, to).forEach(whatever) and forEach(from,to,whatever)
 
@Xeo The STL is far from perfect. For example, how do you generically find something in a container? :)
 
The STL is outdated
Switch to the Standard Library
 
STandard Library :P
 
@TomalakGeretkal You almost always want the whole collection, and I'm tired of writing begin() and end() all the time.
 
Xeo
8:39 PM
That's not how I use the term
 
Shut Thy Lips!
@Xeo: It should be.
 
@TomalakGeretkal Close your output stream!
 
Xeo
@TomalakGeretkal STL for STandard Library?
 
CYOS doesn't have the same ring to it
 
ah, I'll probably just say "STL is a synonym for Standard Library" and let all the pedantics quit whining
 
8:39 PM
@Xeo No, STL for STL and Standard Library for Standard Library
 
Xeo
@TomalakGeretkal Erm, that's how I use it
 
hint's in the name, etc
 
Xeo
I meant the STL
 
@Xeo: Ace!
Alright =)
 
2 mins ago, by Xeo
@FredOverflow Member functions suck for algorithms, hasn't the STL taught you anything? :s
This is not an incorrect use of STL.
 
8:40 PM
@DeadMG Like when returning the result of a find method or something?
 
ah yes, let's see if we can't confuse C++ newbies some more by changing the terms they're used to around
 
It was the STL that taught C++ programmers about this.
 
see how people like @DeadMG propagate the lie so much that I have to assume you were using it incorrectly!
 
based on what we, the lucky self-elected elite, know about a fucking 15 year old library that hasn't had any relevance whatsoever since 1998
 
@FredOverflow Yes indeedy. A range is not an appropriate return value for such things
 
8:41 PM
It's relevant when you frequently time travel. Don't be so selfish, just because you can't afford a time machine.
 
Xeo
@TomalakGeretkal I think we already discussed that here.
 
@Xeo: Seems likely
 
just like I plan on defining that automatic duration objects can also be known as "on the stack"
 
@DeadMG Instead of returning an iterator, couldn't you just return nothing and pass a lambda function that receives the found element instead?
 
@FredOverflow Continuations!
 
Xeo
8:42 PM
@FredOverflow Ugh, continuation passing style now? Really?
 
the problem with that is, what if not found?
 
@DeadMG OMG but there is no such think as stack!?! trollolol
 
Call a different continuation!
 
Xeo
@DeadMG bool return and the lambda is not called
 
lol
 
8:43 PM
Great idea, pass two lambdas! Then it's almost like patterning matching, just with an aweful syntax.
 
It's continuations all the way down!
 
I'm not actually particularly against such things
but I think I'd want to think hard about it
or just provide both overloads
 
Why don't you get rid of return types entirely in favor of continuations? And then call the language Cont++.
 
CPS is ugly in pretty much every language I've seen it, except for Haskell.
 
I value function composition highly
no return values => no function composition
 
8:44 PM
Nice, all you pros are here. I heard that MSVC implemented two phase lookup wrong. Could that cause it to ignore previously defined specializations? MSVC10 is crashing on this code: ideone.com/SMMyJ.
 
But you can compose continuations!
 
@DeadMG But it would be so pure, beautiful and entirely useless!
 
You don't need function composition when you can compose continuations.
 
@MooingDuck thanks for editing my answer, I was lazy.
 
lol
 
8:46 PM
Does boost have something like an uninitialized vector for PODs?
 
why would it? the constructor calls will just get optimized out by the compiler
 
(Wait, what's the new term for POD again?)
 
@DeadMG why?
 
Xeo
@MooingDuck Relevant.
 
@FredOverflow POD.
 
8:47 PM
@DeadMG container elements are value-initialised at least. what constructor call would you like to be optimised out?
 
@DeadMG What? No. std::vector<int> all_zeros(1000000);
@RMartinhoFernandes Oh, I thought there was some new terminology.
 
14
A: What are Aggregates and POD's and how/why are they special?

R. Martinho FernandesWhat changes for C++11? Aggregates The standard definition of an aggregate has changed slightly, but it's still pretty much the same: An aggregate is an array or a class (Clause 9) with no user-provided constructors (12.1), no brace-or-equal-initializers for non-static data members (9.2),...

 
Xeo
@FredOverflow provide a no_init_allocator that just does an uninitialized construct. :P
 
There is new terminology, but those are POD supersets.
 
Xeo
8:48 PM
@TomalakGeretkal and argc and argv too!
 
@Xeo Allocators never initialize, they just provide the storage. The initialization is done by the vector itself.
 
Xeo
@FredOverflow allocator::construct would like a word with you.
 
@FredOverflow: But containers use the allocator to construct
 
isn't there some fishy clause that they're not required to use it for construction?
 
Really? That's news to me. I really should lose my allocator virginity.
 
8:49 PM
@Xeo heh
 
@RMartinhoFernandes Damnit, I can't upvote :(
 
Why not?
Gimme the repz!
 
Because it already has my upvote :)
 
Ah, standard layout was the term I was looking for. Can you explain in once sentence the difference between POD and standard layout? :)
 
8:51 PM
Standard layout types can have custom copy semantics.
 
Oh wait, standard layout is part of being POD.
 
how do i get a pointer to an inode?
 
What's an inode?
 
@Ollie pray
inodes for the inode god!
 
cpx
In computing, an index-node (inode) is a data structure on a traditional Unix-style file system such as UFS. An inode stores all the information about a regular file, directory, or other file system object, except its data and name. Origin of term according to Dennis Ritchie The reason for designating these as "i" nodes is unknown. When asked, Unix pioneer Dennis Ritchie replied: Details A file system relies on data structures that contain information about the files, beside the file content. The former is called metadata—data which describes data. Each file is associated with an in...
 
8:52 PM
number that a file is given, unique to the file and it hold all the file data
 
Xeo
@Ollie Maybe from Apple?
 
such as where the blocks are and shitt
 
Anyway, the usual method of getting a pointer is to use the & operator, to invoke new, or to call a function that returns such a pointer.
@Xeo lol
 
You can also reinterpret_cast an int. shivers
 
@Xeo GG
 
8:53 PM
so if stat->st_ino returned the inode number could i use inodeptr = stat->st_ino;
read_map(&inodeptr)
 
@RMartinhoFernandes Or you could wait for an array to decay. Usually it happens pretty fast :)
 
Right, shake an array.
 
Would stirring also work?
 
What's the half-life of an array?
 
two tokens
 
8:55 PM
@FredOverflow james bond[007]; // shaken, not stirred
 
@RMartinhoFernandes By the way, 007 is the last valid agent literal. 008 does not compile :)
 
questions like this make me seriously consider just how much damage that OOP evangelists have inflicted on the software industry: stackoverflow.com/questions/8495920/…
 
anyone familiar with qmake?
 
> Now I need a new class, SDLEnemyBullet
This is where I started laughing :)
 
@FredOverflow Yeah, I paused for a while to make sure it was valid :)
 
Xeo
8:56 PM
@TonyTheLion I'm familiar with quake, does that count?
 
cpx
May i convert array to pointer with reinterpret_cast? will it be equivalent?
 
I want to basically compile or whatever my Qt Gui project with qmake
@Xeo lol no
 
My favorite example of multiple inheritance is a CowboyWindow, though. What happens when you invoke the draw method? :)
 
Xeo
@cpx You don't even need that
 
@TonyTheLion it's easy
 
8:57 PM
@cpx The pointer will decay before being fed to reinterpret_cast.
 
cpx
or even static_cast :s
 
just run "qmake -project" in your source directory, and hope it does the right thing.
 
Xeo
@RMartinhoFernandes Now we got decaying pointers? God help us! What does it decay to, an array?
 
@Xeo lol
 
if not, modify it so it works :)
 
8:58 PM
@Xeo You're hallucinating.
 
@rubenvb how?
 
Xeo
Y'know @RMartinhoFernandes, you could have let that one unedited.
 
52 secs ago, by rubenvb
just run "qmake -project" in your source directory, and hope it does the right thing.
 
I tried to do qmake -tp vc mypro.pro
 
Xeo
So just once answers to your posts make sense after being sent
 
8:58 PM
@Xeo But I can't be wrong on the Internet! Ok. I'll leave it for the joke.
 
@TonyTheLion so you already have a .pro file?
 
Xeo
:)
 
@rubenvb yes I manually created it
 
cpx
@RMartinhoFernandes means it will have no effect? :/
 
@TonyTheLion does it work?
ie, does running
qmake
nmake
work?
 
8:59 PM
no, cause qmake complains I have too many vs versions, when I want to make it for visual studio
 
Xeo
And if it decays to an array, we got infinite decaysion.
 

« first day (423 days earlier)      last day (4524 days later) »