« first day (420 days earlier)      last day (4544 days later) » 

3:00 PM
Then I shall be grumpy.
 
Or try to be, at least.
Folk music?
 
also arr[i, j] is a popular example
it is not a multi dimensional index!
 
@ManofOneWay Why have an unnecessary intermediate stage?
 
3:04 PM
it can be more convenient to first go to a more or less parser tree and then transform that to an AST
 
I don't know, maybe it can generate better error control if you don't convert it to AST directly
 
What property would make it not-an-AST?
 
you can still keep location information in AST nodes
tho at some opoints you have to convert to DAGs anyway
@RMartinhoFernandes personally i don't consider it an AST if it doesn't contain semantic information
 
Yes, AST is for semantic use
 
I guess that's why it's called Abstract Syntax Tree.
 
3:07 PM
the "other" tree could be for syntax only
 
@RMartinhoFernandes that just says that it roughly represents the syntactical structure. it doesn't mean that it only represents the syntactical structure.
 
btw, why on earth can you instead of typing int a[5] say int a<:5:> and a<:1:> to retrieve an element in C?
 
to me it means that it can and is used for semantic purposes
 
@ManofOneWay Once upon a time there were some crappy keyboards.
 
yu can say 1<:a:> too
 
3:08 PM
So you can say 1[a] too?
 
You can also say 1[a:>
 
@JohannesSchaublitb I find little value in giving personal definitions to commonly used terms. It reduces their value as communication tools.
 
what does 1[b] even mean? a b bunch of ones?
 
The same as b[1].
 
@RMartinhoFernandes as a matter of fact, i don't think that "AST" has a mathematically precise definition
only if "b" is a pointer
not a class type object using operator[]
but may be gained from an array or class type object using "operator T*"
0
A: The move function in unique_ptr C++03 emulation

Johannes Schaub - litbThe reason is because you cannot initialize a unique_ptr with another unique_ptr without doing a user defined conversion (to rv, by passing the rvalue to the rv-taking constructor of unique_ptr). However when not explicitly calling the ctor of T you do a copy initialization which in your case fir...

 
3:17 PM
@JohannesSchaublitb Could you give an example when you say b must be a pointer?
 
vector<int> a{1}; 0[a]; invalid.
 
Good afternoon!
 
Well, it's bit obvious.
 
It works on pointers only because of silly pointer arithmetic.
 
3:22 PM
Could the ellipsis operator be used in places other than in defines/declares of variadic functions?
 
What's the best way to send messages from a c++ program to a flash/air program on the same machine? Preferably cross-platform
 
Ellipsis is not an operator.
 
@ManofOneWay yes, when expanding parameter packs
or when declaring parameter packs
 
sockets?
 
3:25 PM
Hi guys, can you please help me to solve my problem? stackoverflow.com/questions/8457402/…
 
30 mins ago, by R. Martinho Fernandes
I'm setting down new rules here: if you want to set up a quiz on this room, you must specify all limitations that make your solution the only one.
 
I have a pointer P. Please write code that shows that *(P + 0) and *(P) are not completely equivalent !
 
Meh, sockets. I don't like network programming.
 
It's fun :)
 
No, it's not.
 
3:26 PM
for example, one yields a compiler error and the other not. or some such
 
#define P
I win.
 
err wait
 
@Pubby please look again. i changed question
@RMartinhoFernandes P is not a pointer in your code... it's, err, nothing?
 
P could be a const pointer?
 
3:29 PM
void* crashes on arithmetic?
 
On dereference too.
char* P;
#define P
std::cout << *(P + 0);
std::cout << *(P);
 
P is not a pointer in that code it is nothing
 
@JohannesSchaublitb Look again!
 
because it gets replaced
 
P is function pointer?
 
3:30 PM
no macros no string literals no comments etc..
PLZ
 
@Pubby you now gave one possible solution
there is one other xD
applause for @Pubby
 
* bows *
 
When I'm bored, I play games.
 
Xeo
@JohannesSchaublitb Does "member function pointer" count as the other one? :P
 
3:35 PM
That's not a pointer.
 
I know it as "I'm not often bored. But when I'm bored, I play games. "
what @RMartinhoFernandes says xD
 
Xeo
:(
 
also you cannot deref them with star
 
Xeo
ah, right
 
is it related to null?
 
3:36 PM
not at all xD
 
Xeo
but weren't the other solutions already given? void pointer and const pointer. Or do you mean even another one?
 
one will give a compiler error the other doesnt
 
@Xeo Both fail with void pointers.
 
i didn'T see a "void pointer" or "const pointer" solution
 
Hm, maybe I should try something new for that blog that I can't fucking finish. Erlang, or Haskell.
 
Xeo
3:37 PM
@RMartinhoFernandes Damn dereference
9 mins ago, by Man of One Way
P could be a const pointer?
 
yes it could
 
so it's not void*?
 
No. Neither compiles with void*.
struct x { bool operator*(char* p) { return false; } };
x a;
char c = 'a';
char* P = &c;
std::cout << *(P + 0);
std::cout << a *(P); // Yes, I like cheating
// prints "a0"
 
@Xeo that P could have some property doesn't mean the property is sufficient to be the solution
 
typedef int* P; operator*(P); ??
 
3:40 PM
lol @RMartinhoFernandes
 
@Pubby Can't overload operators for builtin types.
 
restriction: "*" must mean "dereference"
 
P is still a builtin type.
@JohannesSchaublitb There you are again, breaking the rules! :P
 
int *(P);?
 
3:42 PM
@RMartinhoFernandes earns an ice for having a tricky solution to my unmodified question
 
@Pubby Doesn't mean "dereference" there.
 
oh, right
 
SO...
what about
 
Everyone loves ICEs.
 
struct X; X *P;
 
3:43 PM
Specially the puppy.
 
RARGH COMPILER ERROR RARGH
 
@JohannesSchaublitb Er, *(P) compiles?
 
Xeo
@CatPlusPlus Oh, I thought of that as "Integral constant expression" not "internal compiler error" :(
@RMartinhoFernandes Sure, you can get a reference from it
 
@RMartinhoFernandes why should it not :)
 
Oh, it does, you can have references.
 
3:44 PM
sure
@Xeo i thought of it as "frozen ICE".
 
Ancient ICE of ancient GCC.
 
IntegralConformingExtension !
 
I'm wondering if Text.Html really works better in practice than plain-text templates.
 
if it crashes on invalid code and gives a core dump on screen that's a viable diagnostic message.
 
Diagnostic: compiler sucks.
 
Xeo
3:47 PM
@RMartinhoFernandes Imagine a compiler crashing with "Sorry, I suck. :("
Wouldn't you feel sorry?
 
... but long long long is too long for me!
 
That sounds nasty.
 
Xeo
long chicken;
 
> PROGRAMMER IS INSUFFICIENTLY POLITE
 
3:49 PM
struct A { long friend dick(); };
 
Xeo
@RMartinhoFernandes Japanese programming language? :D
 
Xeo
@RMartinhoFernandes lol, -22
 
string name() { } namespace A { struct B { friend string ::name(); }; }
 
I have no idea what caused that.
 
3:51 PM
string name() { } namespace A { struct B { string friend ::name(); }; }
 
@JohannesSchaublitb template specialization not being able to have arguments be evalauted?
 
what's the difference between the codes!?
 
diff says friend string instead of string friend.
 
will both work ?! or
 
Xeo
@JohannesSchaublitb Neither will work, "name must return a value" :P
 
3:54 PM
Can't declare string::name as friend.
 
Yeah, C++ syntax is awesome. (I hope the sarcasm is obvious.)
 
none of us need you to tell us that C++ syntax sucks
 
it doesn't suck...
 
3:56 PM
Right.
 
i find it good that it has these many possibilities to express yourself
 
Huh, my update mailer appears to have failed.
 
2D arrays...
0
Q: C++ assigning values to index 10 of an array affects index 0

Ahoura GhotbiI have a 2 dimensional array that is filled with info and has 10 indexes. When I run the code below : for(int studentIndex = 0; studentIndex < numOfStudents; studentIndex++) { if(grade[studentIndex][9] > 59){ grade[studentIndex][10] = 1; // 1 stands for pass }else{ ...

 
3:58 PM
COBOL == C, Ocaml, Basic Or Lisp
 
@JohannesSchaublitb Smallest common divisor or something
 
@StackedCrooked only COBOL is safer than C++!
 
From that set, OCaml wins.
 
int a = 5;
void *A = &a;
void *pp = (A + 10);
why doesn't this fail? I thought you couldn't add to void pointers?
 
some compilers count void* as 1
 
4:01 PM
And you can't.
Are you compiling with all the good flags on?
 
gcc doesn't give any errors so I'm assuming it counts void* as 1 then
No
 
I really need to get rid of metalog.
 
Which are the good flags?
 
It took 526 hours of CPU time in last 90 days.
 
4:02 PM
One of -std=c++0x (-std=c++11 from 4.7 onwards) and -std=c++98 and all of -Wall -Wextra -pedantic.
 
I mean, wtf.
 
how can you log it that precisely
 
Xeo
@CatPlusPlus ~6 hours of CPU time per day?
ouch
 
It's hogging entire core all the time.
 
That's how close you can get to an actual C++ compiler with GCC.
 
4:04 PM
Actually I'm compiling pure C now, but I got a funny warning,
h.c:8:2: warning: C++ style comments are not allowed in ISO C90
//int a[ ...
Isnt // a C90 thing?
 
C89 doesn't support line comments.
C99 adds that.
 
ah C99 of course
 
I didn't even know C90 existed, I thought of C99 all along
 
4:05 PM
There's no reason not to use C99.
Why GCC defaults to crappy mode is beyond me.
I have a feeling I should just rm -rf / entire server and start from scratch.
 
Suggestions for dinner?
 
I also have a feeling I should have not extended this one and buy a more powerful one instead.
@ManofOneWay Food.
 
I'm thinking of meatballs actually
 
Oh wait, syslog behaves the same way.
So actually something is logging all the time.
What the hell.
 
4:12 PM
Would looking at the logs help identify the culprit?
 
Yup. It's kernel.
Dec 10 17:13:06 [kernel] PAX: refcount overflow detected in: swapper:0, uid/euid: 0/0 and crapload of debug info.
 
shakes fist
 
I'm cold
 
grsecurity, Y U NO IN KERNEL TREE YET.
 
4:20 PM
you know
I see an increasing amount of people asking to see my source code
is that a good thing?
 
Everyone wants to laugh at it.
 
lol
you know, I could really use partial classes right now
 
Just push to a public place. You're using VCS, right?
 
@DeadMG Just show us the code
 
sure
 
4:24 PM
=)
 
lol
I don't know if I actually want to
I need to fix my AST design
I don't want to start putting LLVM code in my AST, but I also don't want to have to rebuild something virtually identical for semantic analysis
well, I guess it won't be that identical
 
It's damn cold.
 
user406009
4:41 PM
Ok, two little questions here: 1. Does boost::variant only use stack storage? 2. Does boost::variant use the same storage as a union(it's size is the largest member)?
 
Second multi dimensional array question today: stackoverflow.com/q/8457979/46642
@EthanSteinberg #2: No. It uses more: it's a tagged union.
It needs at least space for the largest member and for the tag.
 
ok
I need to stop forgetting half my gramma
it helps to do that
 
user406009
But it still uses less memory than a struct of all the members. So that is good.
 
It has different purpose than struct of all members.
 
22 hours ago, by R. Martinho Fernandes
@DeadMG lol. You should write that down, you know.
 
4:43 PM
I have
it's right here
pulled it from my bitbucket
 
The basic boost.variant thing is not difficult to write. The real magic is the recursive stuffs.
 
user406009
Yeah, most stuff in boost is full of compile time killing magic. Still, I would rather have the type safety of boost::variant than "string typing"
 
Agreed.
Nevermind, found a question.
 
user406009
@RM Offsetof is use for stuff like opengl, when you have to manually specify the offset of a member in an array.
 
user406009
God, and I cannot believe I was using this for all this time

inline
void *offset(int floatNum)
{
   return (void *)(sizeof(float) * floatNum);
}
 
4:57 PM
i dont get tbb installed
 
user406009
Learn something new every day.
 
One more success with my crappy mspaint diagrams: stackoverflow.com/a/8457944/46642
Which, btw, is wrong. Dammit.
 
user406009
Why the heck would you need to know the offsets of your bases?
 
user406009
That really smells of UB.
 
For the same reason you would need the offset of a member?
A base is just like a hidden member.
 
user406009
5:02 PM
The offset of a member is defined by the standard though. The offsetof inline function is defined. So it is not UB.
 
No invalid pointer is ever dereferenced in the macro.
Plus, it's defined inside the COM libraries, so it can rely on compiler-specific guarantees.
 
user406009
Yeah I guess. The users defining the language and all that.
 
Btw, offsetof is a macro.
 
user406009
More of a builtin than a macro. This is what is in clang

#define offsetof(t, d) __builtin_offsetof(t, d)

And it turns out it only works correctly on PODs, but that is fine.
 
anyone know how to remap every vim key?
 
user406009
5:12 PM
@RMartin I just came up with an intersting idea for C++. Get rid of the whole POD or non-POD semantics. All structs are PODs and are limited by whatever the standard declares are PODs. All classes are non-PODs. This would simplify C++ so much.
 
No really, it needs a lot more than that to be simplified.
static_assert(std::is_pod<T>::value, "T must be POD"); works fine right now.
@Pubby What do you mean "every vim key"? You can remap one at a time.
 
@RMartinhoFernandes I want to rearrange every individual key
 
That sounds extremely weird. But AFAIK you can remap all of them.
Are you trying to use vim as emacs?
 
can somebody help me install tbb? i dont get it
 
I am trying to use vim with a non-qwerty keyboard
 
5:17 PM
Ouch.
I would simply change the system keyboard layout.
 
to what? I forgot how to type on qwerty
 
user406009
I am already using vim with a non-qwerty keyboard. It works fine enough. The keys are just in different places. Learn the new places.
 
I want hjkl to be on home row
the other keys I care less about
 
user406009
Yeah, then you need to remap those in the .vimrc .
 
user406009
5:19 PM
An interesting idea would be to write a program that reads the keymap file and turns it into a .vimrc .
 
If you want to knock yourself out :nnoremap x y for normal mode keys, inoremap x y for insert mode, and so on...
 
where can I find an explanation of those commands?
 
:help :noremap
 
it doesn't really explain anything
just gives me a list of stuff
 
Oh, the explanation starts a bit before.
 
user406009
5:21 PM
@Pubby One last suggestion, if your keymap is colemak or dvorak, look on the forums for those keymaps. Someone should have already made the right .vimrc and posted it. Or just google "myKeyMap .vimrc"
 
I'm using colemak. I saw that page before although I thought someone said it was strange layout
 
Yeah, it uses wasd style movement
 
so map changes stuff in normal mode
imap in insert
and so on?
 
5:26 PM
Yes. But don't use map. It's dangerous, like C macros. Use noremap instead.
map x y may end up doing something completely different if y is mapped too.
noremap x y is guaranteed to do what y does in the default settings.
 
even in different modes?
 
There's inoremap and so on, for other modes.
 
so I could write a program to automate this?
 
I guess so.
 
does it work with sequences?
 
5:29 PM
Like what?
 
aren't there some commands that take 2 keys?
 
what to do there?
 
Special keys are like this: <S-A> (Shift+A) and <C-X> (Ctrl+X), or <CR> (enter). There's a list somewhere.
 
hm, there's a langmap option
 
5:31 PM
Just how I like my saturdays; lazy. :D
 
@Pubby Oh, that sounds much better than remapping everything by hand.
 
@EthanSteinberg So a struct with a virtual base class is a POD?
 
I would be a POD that sucks.
 
user406009
@curiousguy No, the compiler would enforce POD rules at compile time.
 
But you can statically assert the POD rules already. Without breaking old code.
 
user406009
5:36 PM
It is just an idea to force people to state their intention. So you could read someone's code and if it declares a struct you can say for certain that it is a value object.
 
I personally find static_assert(std::is_pod<T>::value, "T must be POD"); much more obvious.
 
hmm
remember in c++11 the split is much finer
you get away with nonpod in many situations
 
Right, you can also write static_assert(std::is_standard_layout<T>::value, "T must have standard layout");. Which the struct == POD approach doesn't allow.
 
user406009
@RMartin That does not help so much when it comes to other people's code. But I will certainly use that static_assert when it comes to declaring that this is a value type.
 
I have a char[50] and I want to copy in a const char*, can I use strcpy for that?
 
5:40 PM
@EthanSteinberg And how would changing the meaning of struct help?
@TonyTheLion Yes.
Prefer strncpy though.
 
user406009
@RMartinho I think it would prevent errors when people think they have a POD, but they really do not.
 
Not everyone writes struct because they want a POD.
 
argh
hate distractions when I'm in the middle of shit
 
how is a struct a pod?
to me a struct is an aggregate for example. for others it is just a class
 
Changing the meaning of it would only result in pain from broken code that was perfectly fine.
 
5:44 PM
hey robot
help me with a cleaner definition of left-recursive rules
 
Hi.
Fire away.
 
I had one and then some asshole distracted me
 
don't be distracted by ass holes
 
I should warn you I'm on a flaky 3G zone, and this crap may fail at any moment.
 
ok
actually, nm, I invented it myslef
 
5:46 PM
lol
I realize my ability to fix problems by my sheer presence is still working.
 
is there a list of unused vim keys?
 
well
I realized that I was just being lazy, that's all
not performing a proper translation of my grammar
fuck
I was so in the zone :(
 
Lambdas are awesome for initialization lists.
 
lol
@RMartinhoFernandes please explain
 
@DeadMG Do you have your grammar yet so that we can take a look at it?
 
5:58 PM
ah you mean those!
 
yes, but I see no reason to share it
not while I'm actively modifying it
 
struct foo {
    int x;
    foo() : x([]() -> int {
        do_complex_stuff();
        and_then_some_more();
        return something();
    }) {}
};
 
lol you are embarassed
 
@JohannesSchaublitb Like this.
 

« first day (420 days earlier)      last day (4544 days later) »