« first day (587 days earlier)      last day (4360 days later) » 

12:00 PM
I do hope there's a better alternate VS11 IDE out there supporting the all-mighty IntelliSense, and doesn't give a F about paying to develop desktop apps in Win8.
 
Aw come on. Intellisense sucks. And it it sucks even more for c++11
mingw indeed. I predict clang will come to windows, as well as mingw. Perhaps we could even see something like Xcode come to windows in the very long term
 
If libclang works on Windows, implementing syntax highlighting, real-time diagnostics and code completion using it is trivial.
 
@Pubby indeed a semi colon is correct. The comma implies you are talking to some one called 'tits'
 
@RadekdaknokSlupik Not quite. Or does it implement incremental edits to the code? Not that I’m aware of, yet this is crucial for an IDE
 
@KonradRudolph libclang supports unsaved files.
So it is trivial. :)
 
12:06 PM
@RadekdaknokSlupik That’s not what I mean
If I change a single character in a single source file line, what does libclang do? Parse the whole file anew?
 
@KonradRudolph no worries. we all make mistakes
 
or does it update the parse tree incrementally?
 
Let me look that up.
 
I don’t believe it does, since that is horribly complicated
 
12:07 PM
Look what just got reported to the htop bug tracker:
Talk about first world issues
 
> This routine can be used to re-parse the source files that originally created the given translation unit, for example because those source files have changed (either on disk or as passed via unsaved_files). The source code will be reparsed with the same command-line options as it was originally parsed.
> Reparsing a translation unit invalidates all cursors and source locations that refer into that translation unit. This makes reparsing a translation unit semantically equivalent to destroying the translation unit and then creating a new translation unit with the same command-line arguments. However, it may be more efficient to reparse a translation unit using this routine.
I don't know what they mean by "more efficient". It does say semantically equivalent.
 
@sehe What's wrong with it?
 
since the method takes no arguments indicating the change, I’d guess “not much”
 
@Collin Nothing in my opinion: perhaps he thinks it is a problem that no process list is visible :)
 
12:09 PM
I'll take a look at the implementation of that function.
 
VS works by incorporating edit operations into the parse tree
 
@sehe apparently I've never used htop, is the 32 a list of processors and the task list would normally be below it?
 
user784668
@sehe can haz link?
 
@RadekdaknokSlupik I think it is the documentation of the designed public API:
> However, it may be more efficient to reparse a translation unit using this routine.
 
user784668
@Collin Yes.
 
12:12 PM
@RadekdaknokSlupik To me that implies that you can expect that any 'future' smart features to 'partially' invalidate parse results will be applied to this function. It also clearly implies, that at this moment, such optimization does not exist.
 
I must say that code completion and syntax highlighting are slow as hell in Xcode when using Boost.Spirit.
 
Here's your libclang for syntax highlighting.
 
user784668
@RadekdaknokSlupik s/code completion and syntax highlighting are/everything is/; s/ in Xcode//
 
sbi
@RadekdaknokSlupik That's one hell of a triviality, IYAM.
 
12:23 PM
@RadekdaknokSlupik Typing . and -> triggers a whole slew of template instantiations?
 
Another "why can I define class more than once" question.
Maybe we should make one of those FAQ.
 
user784668
@CatPlusPlus +1
 
And be 'we' I mean 'you', because I'm too lazy.
 
Chilling on the bed, trying to fall asleep whilst playing some guitar... The only problem was that the guitar couldn't continue playing on its own. And I'm up again. 32 hours without sleep, damn.
 
@CatPlusPlus Sign of a talented programmer.
 
12:26 PM
@CatPlusPlus Huh? How do they manage to do that?
 
0
Q: Why linker allows to have multiple class definitions with the same method defined?

Rafał RawickiConsider file first.cpp containing class definition and use: #include <iostream> struct Foo { Foo(){ std::cout << "Foo()" << std::endl; } ~Foo(){ std::cout << "~Foo()" << std::endl; } }; int main(){ Foo f; return 0; } and second.cpp containing co...

 
@CatPlusPlus I don't recall ever encountering that situation.
 
You encounter it every time you include a header with class members defined.
IOW, C++ sucks
 
@CatPlusPlus This is finally a statement we can all get behind
 
It did happen once though that I had two different classes with the same name defined in two different compilation units. The linker decided to pick one of them and use it at both places. This resulted in one of my most madness-invoking debug sessions ever.
 
12:30 PM
@Fanael in case google is down: sourceforge.net/tracker/…
@StackedCrooked ODR FTW IMO
 
And I was reminded to always use anonymous namespaces.
@sehe Err..?
 
It's an ODR violation.
 
> Some violations of the ODR must be diagnosed by the compiler. Other violations, particularly those that span translation units, are not required to be diagnosed.
Dang.
The One Definition Rule (ODR) is an important concept in the C++ programming language. It's defined in the ISO C++ Standard(ISO/IEC 14882) 2003, at section 3.2. Summary In short the ODR states that: #In any translation unit, a template, type, function, or object can have no more than one definition. Some of these can have any number of declarations. A definition provides an instance. #In the entire program, an object or non-inline function cannot have more than one definition; if an object or function is used, it must have exactly one definition. You can declare an object or function th...
 
Yeah, clang. You are really helpful today.
Oh yeah fuck, boost::any cannot be moved.
 
Those are mostly compiler specific quirks and the just mentioned ODR violation across multiple translation units. Visual C++ won't allow it, it'll throw a link error.
 
12:35 PM
Is inline assembly condoned by the standard?
 
@StackedCrooked C# already violates that principle
 
Never mind, found it. (The meaning of an asm declaration is implementation-defined.)
 
@StackedCrooked How would the compiler diagnose them. cc -c tu1.cpp; cc -c tu2.cpp;... Yay for independent compilation
 
This maintained C++11 draft on github, is it avaiable as a downloadable pdf or do I need to build it?
 
Can the compiler do tail call optimization here?
Token Lexer::lex() {
  ++current_;
  if (std::isspace(*current_) && *current_ != '\n') {
    return lex(); // <-- tail call optimization??
  }
  if (*current_ == '\n') {
    return Token(Token::Type::EndOfLine, get_current_location_());
  }
}
 
12:43 PM
@StackedCrooked You need to build it. Or get it from the Robot's profile page
 
@sehe Not the compiler, but I figure the linker could detect that there are two different definitions of the same class with the same not.
 
@RadekdaknokSlupik Yes.
 
@StackedCrooked how so? TU1: struct A { static void f(int); };, TU2: struct A { static void f(double); };
 
Though to be on the safe side, make it if-else, not two ifs.
 
12:45 PM
@sehe I don't know how it works.
 
Agreed, it has to be one of the two.
 
No all ODR violations are visible to the linker. Not unless the linker gets meta data from the compiler, but that means it will only detect it for object files compiled by the 'native' compiler (or linking with the linker from the same toolchain)
I might be just so that compilers that start to do smarter LTO these days will also be able to provide smarter ODR diagnostics
 
C++ compilation model is obsolete as hell.
 
@RadekdaknokSlupik I don't see why not, you do a clean function call and the function returns immediately after.
 
@KillianDS I wanted to be sure. There may be a shitload of whitespace in the being lexed file. So tail call optimization can be done whenever you return the result of a function immediately?
What about the destructor of the result?
 
12:51 PM
@RadekdaknokSlupik RVO should take care of that (but other destructors might be a problem, I'm not that big an expert on tail call optimization)
 
@RadekdaknokSlupik Why don't you (1) profile it (2) replace recursion by iteration?
 
tail call optimisations are pretty easy to spot in the generated assembly
 
Also, I'd order the conditions so that '\n' check is done first. isspace might be expensive, depending on locale/charset/encoding
 
@sehe iteration would require code duplication (I have a check for EOF, I would need to do that twice). Profiling is a good idea.
 
aaaargh
why do people defend C by saying "The Linux kernel is in C"?
how stupid can you be?
 
12:54 PM
Torvalds uses C. That alone is a reason not to use C.
 
Token Lexer::lex() {
	do (++current_)
		while (std::isspace(*current_) && *current_ != '\n');
	if (*current_ == '\n') {
		return Token(Token::Type::EndOfLine, get_current_location_());
	}
}
 
I have the developed a tick of pressing the save key repeatedly while editing a document. It's killing my hard disk.
 
@RadekdaknokSlupik I don't see the code duplication.
 
I really really want to be able to kind to my self this weekend and actually get some job applications off
I've been really shit at doing anything towards getting a new job
 
@StackedCrooked: Your HDD sucks, you need more RAM.
 
12:57 PM
@sehe Here is the complete code: ideone.com/1N0gu. Using a while loop would require that EOF check twice.
I left it out because I thought it would make the chat message a bit long.
 
@wilx I think if his application thought "save" meant write to memory, he'd have a far more serious problem on his hands.
 
@Neil: I meant the RAM for OS caches.
 
@wilx The software sucks for actually writing the file even if it is unmodified.
 
@StackedCrooked Software sucks.
 
@RadekdaknokSlupik Not all software.
 
12:59 PM
What are you editing, an ISO file?
 
For some reason, it's never perfect and always contains mistakes.
 
@CatPlusPlus A txt file. Every time a press save I hear a little prr-sound from my external HD.
 
@RadekdaknokSlupik What's wrong with: ideone.com/6bzXx
 
@sehe I didn't think of that! :O
 
Ell
do you guys know .net? or at least the graphics model?
 
1:02 PM
@sehe That's awesome. Thanks. :)
 
Graphics model of what?
 
@Ell Which graphics model?
 
Ell
well, I'm debating whether having a Pen and Brush class is a good idea
 
@RadekdaknokSlupik Note the subtle reordering to keep isspace as a last resort
 
Ell
1:03 PM
Pen is for drawing lines, Brush is for filling
 
@Ell .NET has Pen and Brush classes already. So adding new ones is probably a bad idea
 
@sehe current_ < end_ Shouldn't you use != ?
 
otherwise, some more context is necessary
 
I inverted his own condition, he had `>=`
So... ask Radek :)
 
Ell
Yeah I know, I mean, if I were to write a Canvas class where you could DrawRectangle FillRectangle but for like opengl or ogre or sfml etc. then I'm wondering if having pen/brush classes is a good idea
 
1:04 PM
@StackedCrooked Doesn't really matter.
I want to be safe when, for some reason, current_ > end.
 
@StackedCrooked Sorry, thought you were Radek for a second
 
@jalf Based on GDI or GDI+, isn't it?
 
Phew, that clears things up.
 
Ell
GDI+ I beleive
Why did they have pen/brush classes? Just to pass parameters around or do they have ownership of a lower-level resource?
I will google :L
 
To keeps to visuals pent in.
 
1:08 PM
@Ell Some of them own lower-level resources.
at least, Direct2D's brushes do- you can have gradient or image brushes as well as solid colour and others too
 
Ell
okay
if I have pens/brushes then its another two things I will have to specialise. I think I will just start with a Canvas class where you pass a colour and a width
 
why not just use the existing System.Drawing?
 
@Ell depedns on what problem you're trying to do. For the cases where you'd normally use opengl or ogre, it's a terrible idea, because it's the wrong paradigm. You simply don't do graphics like that in those environments
you don't paint with pens and brushes in a (3d) game. You use meshes and textures and shaders
Otherwise you might as well throw OpenGL away and just use whatever drawing functionality exists in .NET or in your OS
 
Ell
@jalf but for say, the gui aspects of a game (2d) then is it still a bad idea?
 
@jalf They can be useful for the UI code, depending on what style you have
 
Ell
1:12 PM
I have looked at CEGUI but it isn't satisfactory for me because it lacks vector support
 
the reason Microsoft introduced Direct2D and DirectWrite was to do high-performance rendering of 2D content, and one of the use cases is for a game's UI
also, CEGUI is a disgusting Singleton fest, like OGRE, iirc
 
Ell
@DeadMG correct
and I want try and write my own gui library, which I obviously will fail at, but its nice to at least try
and I think its good to learn why certain design choices were made
 
a number of them are because COM is a binary interface which limits what they can do in terms of exceptions, namespaces, etc
although for some reason, the Direct2D and later headers do start including more namespaces and such things
 
Ell
I think I will just leave brush/pen stuff for now, its too much unnecessary stuff for my simple mind probably :L
 
yeah, you'd probably need to start invoking shaders and such things if you wanted to create some gradient/image/etc brushes
 
1:17 PM
damn this heat! I am fighting to stay awake here. Loud Music and coffee ain't doing much
 
Take nap then.
 
Ell
@thecoshman how can you sleep in this heat? :O
 
@Ell how can you stay awake
 
vigorous masturbation
7
 
@wilx as much as I hate this job, I need some form of income. Same response to you @DeadMG
 
1:19 PM
That rather makes you sleep.
 
Ell
@DeadMG I was thinking of a base Canvas class, then CairoCanvas, GDICanvas, etc. Good or bad? in your opinion?
 
@Ell Yeah, that's what I did give or take
but make sure that it's impossible to use a GDIBrush with a CairoCanvas
 
Ell
@DeadMG you did this already? can I have a link/search term?
 
@Ell you want to jack off to a base Canvas Class?
 
1:23 PM
@thecoshman don't push it
 
@sehe ?
 
Ell
@thecoshman good idea!
 
@thecoshman class Canvas { private: void spray(); };
 
don't milk it. the joke's been had
 
I get the pun.
Okay, I'll stop.
 
1:24 PM
:) that was on purpose
 
@Ell huh?
 
Ell
@thecoshman I mean, jacking off to a base canvas class, good idea! I had never thought of that! etc. etc.
 
See, now you don't even.
Get your own ---joke--- failed attempt at milking someone else's joke
 
Ell
but nevermind :L its too late
 
@Ell with a blank canvas, you can paint your wildest desires... unless you can't paint.
 
Ell
1:27 PM
@DeadMG so is this a whole graphics library?
 
@Ell No, just the bits I personally needed
 
I wouldn't touch a GDI canvas with a ten-foot pole
 
@sehe what if I offered you a salmon for it?
 
Ell
@DeadMG what are you using it for? also, what does it have to do with WideC?
 
slap, bitch!
 
1:29 PM
@Ell I'm building an RTS, and nothing
 
@DeadMG Inconsistent indentation!
 
Ell
@DeadMG Oh cool, how complete it is?
 
@CatPlusPlus I know! VS for some reason keeps going back to tabs even though I set it to fucking spaces every time
 
@RadekdaknokSlupik I propose class Canvas { friend class Instrument; private: double spray(); };
 
I need to find out how to get code::blocks to handle name spaces when applying formatting
@DeadMG Hg pre-commit hooks?
 
1:30 PM
?
 
mostly just to play around with them
 
@DeadMG // vim: se ts=4 sw=4 et : works in VS too for me :)
 
but I am sure you could get a pre-commit plugin that will apply source formatting for you
 
@Ell as a rule of thumb, if you can leave it for now, do leave it for now.
 
Ell
:L
 
1:32 PM
Don't write a brush class if you don't need it yet. If you're lucky, you'll be able to defer it until the point where you actually know what it is you need, exactly
 
Ell
yeah they were my thoughts
 
and then you might just find out that it shouldn't be a brush class at all
 
Ell
what should I do about the Image/Bitmap class? I know I will need that, yet i cant tell at all what its base class will need?
so the Canvas class will just have DrawImage(Image&, Point<int>) but the Image class will be completely empty
 
noooooooo
 
fucking unicode
 
Ell
1:35 PM
hmm ignore me, I am talking out of my bottom.
@DeadMG nooooooo?
 
you create an image, and it draws itself until it's destroyed
making the user draw them is for fools
 
Ell
isn't that what a Sprite class is for?
 
I have a technical document, with fucking unicode faces in it
 
@Ell No.
 
what the hell sort of pre-school place is this?
 
1:36 PM
the Sprite class represents the fact that the renderer will draw that image in that spot
 
Yes my lexer's working.
 
Ell
I always imagined the image/bitmap to contain image data, and the sprite to contain image reference and a position, blending mode, etc.
 
when the user creates a Sprite, then the renderer draws it for you automatically
until it is destroyed
 
Ell
so where is the image drawn if you create an image and not a sprite?
 
@Ell It does. Just the renderer keeps a list of them and draws them for you. You don't do it.
@Ell Nowhere.
 
Ell
1:37 PM
so the image is not drawn?
 
yes
 
Ell
That was what I was imagining
 
right
but there is no DrawSprite method
maybe internally? but certainly not in the interface
 
Ell
why should we prefer a Sprite class to DrawImage(Image&, position)?
 
because you don't have to keep all the known Sprites around to Draw them in the interface
think about it - if you want to call DrawImage, you have to keep Canvas references everywhere
and you have to tell every component when it's time to draw
 
Ell
1:40 PM
sorry I'm a bit confused
 
so basically, you are providing a batch handler for them
 
Ell
from that context, I have used Canvas incorrectly, which I probably have
 
in order to call DrawImage correctly
 
to save people from having to manage a but load of stuff on their own
 
you must know both when it is time to draw, and you must have a Canvas reference
 
Ell
1:41 PM
ahhh I see I tihnk this is where there is confusion
 
whereas if the Sprite draws itself, you can make a Sprite and then never know anything else
just like I don't do vector.free_internal_memory();
 
Ell
in my head, it would work like .net, where there is an OnPaint(Canvas) function, so a callback is called when drawing is needed
 
which is a giant mess
easier to simply have the canvas keep a list of all active Sprites and draw them all for you
 
callbacks are overrated
 
Ell
why is it a giant mess? Its for a gui library so I would say it fits the paradigm more? Or am I just wrong?
 
1:43 PM
because you're requiring the user to constantly maintain OnPaint
 
Ell
but the Buttons OnPaint function will be different to TreeView, Label etc. etc. ?
 
no, it will be exactly the same
get all renderable components, draw them
 
Ell
but a treeview looks different to a label?
 
that's just changing the definition of "all"
 
Ell
hmmm wait a second
with your method, you have to keep a vector of sprites/lines/fills/ellipses/other drawables
and change it every time the containing data is changed
 
1:46 PM
as do you
 
Ell
but with the OnPaint version, you just iterate over the contained data and draw appropriately
in my eyes, that is easier and more clean because you dont need a container of drawables
 
yes you do
 
Ell
if the data is changed, you just do nothing with it because it is gone - you dont iterate over it and draw its corresponding node
 
it's just implicit
 
Ell
to me implicit is cleaner, less verbose
 
1:48 PM
if you want to draw something, you must know what to draw
and that is true no matter what method you use
just in the non-OnPaint version, the renderer automatically gets the data for you
 
Ell
I still cant see it?
 
see what?
 
Ell
when you go AddNode to the node data, a Drawable thing (image, label, lines etc.) will also have to be added
to me that just seems more effort?
 
what, than re-creating it every single frame?
 
Ell
well yeah - sort of
 
1:51 PM
your stance is that re-creating the data every frame is less effort than creating it once
 
Ell
doesn't it boil down to a declarative style vs imperative style?
well no, you dont recreate the data every frame
 
no
I can guarantee that every object is drawn properly
you can't guarantee that you remembered to fix OnPaint
 
Ell
i dont understand how your version guarantees the painting is fixed?
 
let's say that your node in the tree is drawn by a little sprite
Node::Node(std::unique_ptr<Sprite> s)
easy
 
Ell
but then you have to have one of those for every data node you have
 
1:53 PM
now you can never, ever create a node that is not appropriately drawn, and the node is guaranteed to clean itself up properly, and you will never have to maintain OnPaint
 
Ell
say your data is a tree of strings, you must also have a tree of sprites
 
not really a tree, it's just one sprite for each node
 
Ell
whereas with OnPaint you just iterate through your tree of strings and draw the appropriate things
 
but that's what you already have too
and in my version, you do not have to keep, for example, lists of paintables around
you can drop references to objects which need drawing and they will continue to function correctly
 
Ell
hmm I am confused now
 
1:54 PM
whereas you must be able to reach all drawable objects every frame
 
Ell
so in your version, you dont have to keep a list of paintables? how so if you have Sprites instead of DrawImage ?
 
because the renderer adds it to it's list on creation, and removes it on destruction
 
Ell
but how does the renderer know how to draw your control?
what if you want to nudge specific nodes to the left by two pixels?
 
@Ell You tell it by creating the appropriate Sprite/etc objects. The render has no concept of controls- it just draws sprites where you tell it to.
 
Ell
so doesn't that mean you have to have a list of sprites?
 
1:58 PM
Node::Node(std::unique_ptr<Sprite> s) { s->position = this->position; s.position.left -= 2; }
@Ell Yes, in the renderer's internals.
 
Ell
I'm sorry I just can't grasp it! have you got any code examples already written you can refer me to?
 

« first day (587 days earlier)      last day (4360 days later) »