« first day (588 days earlier)      last day (4343 days later) » 

12:00 AM
I want to write my parser.
 
I'm gonna hit the sack
 
I was just thinking of that song. :P
@DeadMG that hurts.
 
Ell
Hi guys
 
Hey Ell.
Ell Niño. :L
 
Ell
12:08 AM
El niño effect!
 
Why are you awake so late? :P it's 2 o'cock
 
Ell
How was everyone's days?
 
Ell
It's 1:10 here
@lesrningslowly not really but shoot :L
 
Ell
12:12 AM
And because I can't sleep
Thinking too much :L
 
Sleeping is a waste of time.
Also: think less.
 
Ell
I could try :)
 
Listen to great music.
 
Ell
I am doing :)
 
Write a compiler.
 
Ell
12:13 AM
When you where young by the killers
 
At least, that's what I do when I'm thinking a lot. :P
 
Ell
I can't :L
 
Ell
I don't have the determination or self discipline to write antthing
 
That's unfortunate.
 
Ell
12:14 AM
Everything I start gets given up on after a few days
And then I scrap it and start again
 
Post it on GitHub.
 
Ell
Repeat this again and again
 
Everybody does that xD
 
Ell
Are you just trolling?
I mean, learningslpwly
 
No. It's the truth.
Many programmers create projects and give up after a while or start over.
 
12:15 AM
@Radek What are you building a compiler for?
 
Ell
I am 16
Not super old :L
 
Radek is right, a lot of my projects go unfinished. x_x
 
Ell
And super old OS 100+
*is
 
@LearningSlowly np
 
Ell
12:17 AM
What are you doing up radek?
 
I'm going to rewrite the parser though. It's a mess. The lexer is good.
Diagnostics are also good.
@Ell doing up?
 
Ell
What is the largest part of a compiler?
 
@RadekdaknokSlupik manually?
 
Ell
Parser? Code gen?
 
@NikiC manually. I don't want crappy diagnostics.
 
Ell
12:18 AM
You said it was 2 didn't you?
 
@Ell I guess the parser. I haven't done the code generator yet, so I cannot tell. I'll use LLVM.
 
@RadekdaknokSlupik Most LALR generators also support error symbols. But I see your point :)
 
@Ell oh yeah I'm chatting.
@NikiC my diagnostics include hints and the compiler continues to parse as if you fixed it according to that hint.
 
This subject makes no sense to me....Google here I come.
 
Ell
That's an interesting featuee
Will be useful for missing semicolons
 
12:21 AM
No semicolons in my language. :)
One statement per line.
 
@RadekdaknokSlupik Right, that's why I said error symbols :) They are there for exactly that, reentrant parsing
 
Ell
Ah kk
 
user457812
My language is mostly made up of ASCII genitalia. It has no need for delimiters.
 
But in any case, writing the parser by hand is obviously more fun :)
 
@NikiC oh :P
 
Ell
12:22 AM
I have tried numerous times to write a parser but can't understand it
I need to watch someone write one from scratch
 
Diagnostics in my compiler are similar to those found in clang. I was surprised by how easy it was to implement diagnostics.
 
Ell
What is your language like?
 
@Ell take a look at the link I posted a few minutes back. In libdaklang you can find a simple lexer and a basic, incomplete parser.
 
Ell
Static typed? Strong? Weak?
 
What is the difference between value initialization and zero initialization?
 
12:23 AM
@Ell it's a functional language with RAII, statically typed.
 
Ell
Ahh kk I will tomorrow, I'm on my phone atm
 
Ell
Functional? Ahhh runs away in fear
I don't understand functional languages :L
 
Functional with RAII?
 
@CatPlusPlus why not.
 
12:25 AM
Show an example.
 
pure get_string ->
  ret "Hello, world!"
  # Constructs string object, moves it and destructs the original.
weak main ->
  io::print(get_string())
Not everything can be pure. You need to manage resources somehow.
 
Ell
cough monads cough
 
@Ell And you were just saying you don't understand function languages!
 
Ell
Nah I don't know black magic (functional programming)
 
ret? That's not very functional.
 
Ell
12:29 AM
I don't :L I don't even know what a monad is apart from that it is what haskel uses for io (is it?)
 
I might make that optional.
 
Also, there'll be a lot of that "constructs and destroys" happening.
 
Ell
The reason I can't get functional programming is that I have never been able to do anything useful with them. How can I write a text editor with math like functions?
 
The main reason I'm doing this is for learning to write a parser.
 
12:31 AM
Pure core, impure glue.
 
@Ell Yeah, I have the same problem :) I see how Haskell is all awesome and stuff, but I just can't really imagine using it ^^
 
Ell
don't feel the need to make excuses just becsuse cat has questioned you!
No offence intended to either intended :)
What do you mean, impure glue? And what aspects of a text editor could be pure?
 
Haskell gives you all the tools, only better.
 
Ell
Apart from maybe word count :L
 
I don't know, I don't write text editors.
 
12:33 AM
Text manipulation. Syntax highlighting.
 
Ell
So let's say, open a window, ready for placing controls onto. To start with, is there even a main function?
 
Of course there is.
 
lol
 
Ell
But functions can't have side effects can they?
Nevermind I'm not going to bother with this at this time of night
I'm too tired :L
And listening to overkill by men at work :D
 
There are tons of languages without mains btw. Why do you need it?
 
12:36 AM
You've got all the tools.
 
Ell
I just can't think outside the box I guess
 
@RadekdaknokSlupik daklang::lex::Token::Type::EndOfFile All those :: scare me :)
 
XD me too
The parser is really a mess; I'll rewrite it tomorrow.
First I need some sleep.
 
Ell
You can rewrite a parser in a day?
 
No, but I can rewrite the part that I already wrote.
 
Ell
12:42 AM
Sleep well :) night night
 
I'm not yet going to sleep.
 
Ell
Well I am sleeping now
Ciao
 
night @Ell
 
12:58 AM
It appears that function objects can be used to implement "hooks" in a policy-based design. Not sure this will scale well, but it seems like a fun idea.
Actually function objects in themselves could replace policies altogether.
Hm..
I need some sleep.
 
1:12 AM
does anyone support std::thread yet?
 
You mean if we already used it?
 
@StackedCrooked I guess by anyone I mean any compilers
oh, derp gcc does
even my 4.6 build
 
@Collin It's quite supported.
 
@StackedCrooked Ah, for some reason clang doesn't like gcc's thread header, I took that for not being supported
 
I guess code that would normally invoke UB is fine to use in decltype; decltype(*Map().find(*static_cast<Key*>(nullptr))->second)
 
1:23 AM
@StackedCrooked For the record though that's Map::mapped_type&.
Oh wait, sneaky dereference.
 
@LucDanton Yeah, but you no longer need to know :D
@LucDanton Yes, the map value type is actually a shared_ptr.
This is the actual code. The pointless fruit of sleep-deprived productivity.
Not really so exciting actually.
 
There isn't a convenient trait to represent the type of *foo so you'd do well to use decltype indeed. Still, I'd recommend using std::declval for clarity where it makes sense. decltype(*std::declval<Map::mapped_type&>()) documents intent quite well.
(There are std::iterator_traits and std::pointer_traits but you have to know beforehand which one to use which isn't the case with using decltype alone. Also, std::pointer_traits doesn't have a reference member so it's not convenient.)
 
The long decltype constructions aren't ideal either. Reminds me of Perl for some reason.
Write once.
I'm having fun with it though :)
 
It's okay to write once. When you do write twice or thrice the same decltype/declval construct then it may be time to refactor into a trait.
 
1:41 AM
I'm trying to figure out how to type a non-breaking whitespace, but I don't have a numpad to use the windows shortcut, and I don't know any other way to type/copy it in Windows.
 
} // anonymouse namespace
^ Happens a lot.
inline void UpdateChecksum(ICMPHeader & header)
{
    // Set checksum to zero.
    header.checksum = decltype(header.checksum)();

    // Calculate the checksum.
    header.checksum = CheckSum16(header);
}
Silly decltype :)
Can be used at so many places.
 
2:10 AM
@StackedCrooked header.checksum = {};
 
Right. I always forget about that one.
 
 
2 hours later…
Xeo
4:24 AM
0
Q: _CrtIsValidHeapPointer(pUserdata) AND _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)

ProdigousRangerI just "finished" my AVL tree implementation and went to test what previously worked with a normal binary search tree. But now I am getting these assertion errors when the bsTree constructor is called. _BLOCK_TYPE_IS_VALID(pHead->nBlockUse) is first and if I continue windows spits the next one ...

Close votes please (if anybody's here)
 
@Xeo i can understand the urge to close since the poster forgot to ask any question. but what is wrong with "using namespace std" here? it's all in implementation files, isn't it?
 
Xeo
@CheersandhthAlf I think @sbi's answer in the linked question explains it quite nicely. The identifiers in the std namespace are pretty common ones, and because they're all templates, they might just be a better fit than whatever your want to call.
That's all my opinion, though
 
4:40 AM
It doesn't scan. The argument first goes that one should better qualify everything in order to avoid having to qualify one thing. That's stupid. Then, the argument goes, the code can silently change behavior, and instead of testing your app you should qualify everything. Again, that's pretty darn stupid.
 
5:00 AM
That's a darn mountain of silliness you got there.
 
Well there's even more: "prefixes objectively add clarity to the code". That's a circular argument about clarity. With so many fallacies one would suspect that the position being argued, is not really tenable.
 
5:15 AM
My first job had very strict coding guidelines. There were numerous prefixes local variables, members, globals, input args, output args, io args, static variables, const, enum, etc.. The placement of brackets and commas was defined. Functions where ownership of the return value was passed to the caller had to start with "Create".. Etc...
It did have advantages. If I needed to look at some else's code it immediately looked familiar and I could quickly find my way.
 
5:50 AM
@CheersandhthAlf Incontrovertible fact.
 
6:03 AM
@StackedCrooked dunno what you mean, it's incontroverible fact that's circular? yes. or just a plain dumb assertion. if qualifications were generally clarifying then we'd qualify most everything in ordinary everyday speech. have you observed any of that?
 
I just thought that incontrovertible was a funny sounding word.
 
huh, i didn't know "controvert" was a verb. one learns every day. :-)
 
I learned that word just a few minutes ago. In this thread (second comment).
Actually this comment.
This is quite an entertaining review. Especially at the 12:10 mark.
It features an impersonation of the stereotypical Gurren Lagann fan.
 
6:23 AM
Did I just submit a message to the chat-room or is my browser messed up?
I think my browser just messed up, sorry if this is a double comment then. Anyway, can you guys tell me what you think of this paragraph for my personal-statement (for a scholarship):
"
As the robot’s programmer I decided to challenge myself and began implementing my own independent holonomic driving system in C opposed to using the managed RobotC environment. The driving module was for an embedded ARM processor and utilized the EasyC API to interface with the VEX motors. This helped me grasp a stronger idea of embedded systems programming and provided me some idea of what it might be like to program embedded systems. I used a polymorphic and modular code design in the process; this was my first time implementing polymorphic design concepts such as interfaces and abstrac
 
holonomic means?
 
In mathematics and physics, the term holonomic may occur with several different meanings. Holonomic basis A holonomic basis for a manifold is a set of basis vectors ek for which all Lie derivatives vanish: :[e_j,e_k]=0 \, Some authors call a holonomic basis a coordinate basis, and a nonholonomic basis a non-coordinate basis. See also Jet bundle. Holonomic system (physics) In classical mechanics a system may be defined as holonomic if all constraints of the system are holonomic. For a constraint to be holonomic it must be expressible as a function: : f(x_1,\ x_2,\ x_3,\ \dots,\ x_N,\...
Seems to mean all kinds of things.
 
err that the wheels are configured so that they are at the points of a square. They don't resist movement perindcular to themselves so the robot can technically move in any given direction at any given time
sorry, and you have a good point
 
My points are always good.
 
xD
Heres an example
Actually, this was our robot: Well, its drive system at least. youtube.com/watch?v=OmF2R0_s5Ds
We had some pretty cool ideas for it, but not much time to implement them unfortunately.
 
Lol.

Anyway, I'm going to just submit my personal statement. Too difficult to get a review on it. Not many people who major English and Computer Engineering.

Thanks for pointing out the holonomic thing :)
 
7:14 AM
Holonomic. It reminds me of Daft Punk for some reason.
"He might kneel but he never bends over."
Hadn't noticed that expression yet.
 
Als
7:51 AM
Anyone please tell why this is being frowned upon?
-1
A: C++: Does this leak memory?

AlsWhether this leaks memory? No it doesn't. It seems most of the people have missed the point here. So here is a bit of clarification. The initial response of "No it doesn't leak" in this answer was Incorrect but the solution that was and is suggested here is the only and the most appropriate...

Is this incorrect?
 
where do people think it leaks memory?
It looks fine to me
 
well the OP's code is UB, so it's wrong to say that it necessarily leaks memory
or to say that it will write nasty letters to Obama
it can do nothing or anything
including that it can leak memory
and can crash
as naive person may expect
 
Als
@CheersandhthAlf: hmm..yes true and the point where it didn't follow rule of three it was scheduled to be doomed
 
the solution is to use "int" instead of "int*"
 
Oh I see now. I thought he overrided the equals operator, hmm
 
7:55 AM
i think any other solution must be dumb
 
Als
@CheersandhthAlf sure if can do with it, but looks like simplified sample prog so cant say
 
it's the OP's job to provide an example that reflects the requirements
 
Als
@Jeremy he didn't neither the copy constructor
 
but answers are not only meant to help the OP
 
I agree with Als's comment.
 
7:56 AM
they are meant to help anyone else stumbling onto the question
 
or rather
answer to the question
 
it's much simpler to just use "int" and not have any user defined destructor
 
why is he dynamically allocating an int anyway?
 
all other solutions are rube goldberg constructions in comparison
 
Als
@CheersandhthAlf yes, ofcourse and now that you said it i think i should explicitly add it
 
7:57 AM
yes
:-)
 
Alright, not that I expect anyone cares, but I've finished my personal statement:
https://docs.google.com/document/d/1H1XUSxG5lMuB25w_zRLuEFvqIwYPRMecOu8r30sgp4k/edit
 
Morning.
 
1AM here, so I suppose it works for me.
 
Als
@CheersandhthAlf Done and thanks :)
@CatPlusPlus Hey cat :)
 
basically, I'll just be happy if they look at my personal statement and infer that:
A) I actually developed a passion for the field over-time, its not something I want to 'try out'
B) I am not going in to the program knowing nothing.

And hopefully that will get me the scholarship, lol.
 
Als
8:06 AM
Damn my internet conn is crappy today
keeps breaking down and reconnecting
:(
 
lol
 
8:18 AM
aww butter
He was one confused troll
 
1172
Q: The Definitive C++ Book Guide and List

grepsedawkThis question attempts to collect the few pearls among the dozens of bad C++ books that are released every year. Unlike many other programming languages, which are often picked up on the go from tutorials found on the Internet, few are able to quickly pick up C++ without studying a good C++ book...

Reminds me of my Gr 12 programming class. Some students are doing VB .Net
the book is absolutely horrible
So many errors. Worse, our GR12 programming teacher knows nothing about programming. He gave me a multiple choice test, one of the questions was (for native C++ on x86 platform)

An exception:
A) Causes and unforseen detour in the expected flow of execution
b,c I don't remember what they were
D) Slows down the application
Both A and D are true, at least as far as I know
 
slows down the application ?
riight, no
 
blink blink
 
How not? Devision by zero for example throws an interrupt, goes to the kernel interrupt service routine, which then has to resolve it to a process and find the appropriate exception handler
thus you have a fairly signifcant performance hit
 
@Als huh? couldn't see any change to your answer, so i added an answer of my own. :-)
 
8:28 AM
@ScarletA unless my understand of the proccess is mistaken, in which case I'd be interested in the correction you have to offer.
 
@Jeremy you have to compare it to handling the fault without using exceptions. for integer arithmetic that involves adding expensive checking before each division. which slows things down considerably. compared to that, exceptions may and often are faster.
 
From my own experience i can tell you that exceptions perform faster more often than not.
That being said, there are cases where exceptions are indeed slower.
But the answer "they slow down the application" is plain stupid.
All you do when the exception is thrown is to check whether there's an immediate handler and if not so, then you unwind the stack and keep looking (which is basically what if() checks do but in a less sophisticated way).
Not to mention that they are easier to maintain and for me, easier to read.
 
Well it was something along the lines of causes an impact on performance. I don't recall the answer exactly. Perhaps I was a little lazy in my explanation.
I didn't mean to suggest that it is slower than using another solution
nor that I disagree with using them (I use them all the time)
 
I also like controlling flow with them, partially indeed.
(Mostly while using standard libraries that tend to throw instead of doing whatever else)
 
8:36 AM
Anyway, I don't really agree with the question because imho there is a performance impact (that can vary) and they do disrupt the casual flow of execution
 
Every "error - state" has got to (should) disrupt execution of the flow ...
if (whatever) then (regular flow) else (error flow) -> a basic if literally disrupts normal execution of flow ...
So duuuh, exception disrupt flow by nature ...
 
well that can't be said for all exceptions. If the question had given more of a context I would be inclined to agree
 
That doesn't apply for all IFs as well if the "error condition" fails obviosuly.
Yet your argument is fairly invalid since the whole point of error handling is to actually alter the control flow.
 
Yes but if statements don't usually produce a significant unexpected overhead
 
And that's the fun part, neither do exceptions.
look at the link, there's disassembly posted
 
8:41 AM
I've looked at it and I agree with it.
 
Then you should see that there's no real "overhead" ...
 
But as I said that can't be said for all exceptions.
 
That can't be said for all IFs either.
I though we were discussing the differences and likelihood of either one being faster.
@Jeremy As @CheersandhthAlf said: "for integer arithmetic that involves adding expensive checking before each division. which slows things down considerably. compared to that, exceptions may and often are faster". Ifs can't match this power.
Simply because you have to check before each division.
I'm going to do something shinier and more productive, as for example playing Legend of Grimrock ^^
I shall see you latarrrr.
 
I thought we were discussing whether or not the question with its answers were valid :S I.e, is it wrong to say that exceptions don't impose an overhead but cause an unforseen detour, or that they don't cause an unforseen detour and impose an overhead. Neither statements can be said and thus the multiple choice question is wrong.
I wasn't talking about ifs vs. exceptions
because you can't generalize that all exceptions have a negligable overhead, and it is more appropriate to say that an exception has an unforseen overhead than it is to say that an if has an unforseen overhead. Ifs are much more predictable
well
ifs are more predictable in regards to overhead
 

« first day (588 days earlier)      last day (4343 days later) »