« first day (571 days earlier)      last day (4378 days later) » 

11:00 PM
OK then I will install clang and LLVM and try it again
 
@ScottW only one?
@ScottW you're fine
 
@Maxpm rms said that IIRC, or somebody else. It's mentioned in Clang: Defending C++ from Murphy's Million Monkeys.
That said, I'm a clang fanboy.
I'm interested in writing a debugger.
 
@classdaknokt I use that debugger make sure it is cross platform
 
@TaylorBioniks cross-platform, is that UNIX? I don't care about Windows.
 
Wait, doesn't Xcode use GCC? That's non-free software.
 
11:06 PM
yes all my systems are unix like well most of them
 
@Maxpm Xcode uses clang.
 
Ubuntu, Mac OS X, not AROS or Haiku though
 
Ah ha.
 
Or LLVM-GCC, you can select which one. The back-end is always LLVM. Xcode always uses clang for code completion, syntax highlighting and real-time diagnostics though.
 
@classdaknokt you have any links to clang tutorials?
 
11:08 PM
@TaylorBioniks google "clang thinking behind the compiler". It's a good video to get you started.
One of the things I really want in my debugger is it understanding the C++ standard library.
E.g. looking at the contents of a vector easily.
 
@classdaknok_t in what way?
@classdaknok_t oh, no, you don't want that. You want that to be customizable, not builtin
@classdaknok_t MSVC has that, but it's tricky to customize
 
Then I'll just use scripting to do that.
And ship it with default scripts for the standard library.
Maybe boost.
 
@classdaknok_t sounds good. MSVC uses a custom script thing that's kinda like xml, with builtins for the standard library and all of MFC.
 
I'll use Lua.
 
@classdaknok_t for formatting? Seems like overkill. Immensely flexible though.
 
11:12 PM
@Maxpm Xcode uses GCC, but I think they just run it, unmodified, from a command line.
 
@classdaknokt Lua is cool
 
To build the program, but not to analyze it?
 
@MooingDuck no, for parsing binary data into a more human-readable format. Difficult to explain, let me give you an example.
 
@Maxpm Code analysis uses clang, yes.
That's actually why they decided to make clang, because they couldn't use GCC for anything other than building the code.
 
@classdaknok_t I guess that is what it's doing isn't it? I guess lua isn't overkill for that.
 
11:14 PM
@MooingDuck say you have boost::any, which uses type erasure and all sorts of magic internally. You can write a Lua script which understands boost::any's internal structure, and from that can just show you the value (and the type of it) that the boost::any holds.
 
@classdaknok_t ah, boost::any is a little trickier, it uses vodoo. Namely, it stores no type information in itself AFAIK, it uses C++'s RTTI
I don't know how lua would handle that
 
@MooingDuck the debugger has an internal data structure which is a tree. This tree holds all members, and members of members, and their members, etc… of all objects in scope.
And it can resolve pointers, etc.
 
@classdaknok_t what debugger does? The one in your Ide? I've never heard of anything like that, it would take massive amounts of RAM.
 
So when a breakpoint is encountered you can see what data you have on the stack and heal at that moment.
@MooingDuck Xcode does that using LLDB, but it doesn't understand the standard library.
So it's very difficult to read for a human. (If you have seen the implementation of libc++, you'll see why.)
 
@classdaknok_t MSVC doesn't keep that info, but just scans once it breaks. I'd expect other compilers work the same
 
11:20 PM
@MooingDuck of course it just scans when you breakpoint. I don't have 1000 EB of RAM. xD
 
@classdaknok_t alright, so it also has to use the RTTI to figure out the dynamic type of objects.
 
But the point is that you can pass that data to Lua, and the Lua script can make it readable.
Output from the debugger can be really nasty when dealing with C++, especially when having lots of templates, CRTP, RTTI, pointers…
So you'd have a script that knows std::vector, one that knows std::map, one that knows boost::any or custom ones for your own classes.
std::string, also extremely handy. SQLite, Box2D perhaps.
 
That has nothing to do with templates. You can print members just fine. Scripts are there to make output more useful.
 
@CatPlusPlus I suggest you use a debugger with libc++ and vectors of vectors.
 
You'll see data members of vector.
That's why there's a script — to recurse through that structure and print only elements.
 
11:26 PM
Hidden somewhere deep in the hell of inheritance.
 
@classdaknokt libclang.mov _?
 
@RMartinhoFernandes in soviet russia, plastic has robotic skin
 
@classdaknok_t Yeah, it seems like it should be relatively simple actually, except for the RTTI/dynamic types.
 
@MooingDuck how often do you personally use template metaprogramming?
 
11:28 PM
@stdOrgnlDave a lot, but it's straightforward for a computer to deduce the parts
 
@DeadMG For me, 3.1 which is the soon-to-be-latest version. Beyond that, it's probably going to leap ahead.
 
@MooingDuck but still, you need some software which understands the data structures if you want to provide useful output from the debugger.
 
@classdaknok_t sure. I'm just saying that should be relatively simple, except for dynamic types
 
@RMartinhoFernandes 3.1? I already have 3.2svn.
 
 base* ptr = new derived();
 
11:30 PM
@classdaknok_t 3.1 was not released yet. It's feature frozen for release (RC I think), but still in the final bug fix stage.
The build you have is the main branch.
 
@MooingDuck the debugger could find new expressions and remember the types they were used with and the pointers they return.
 
@classdaknok_t that's much harder than it sounds, and C++ already has RTTI built in to do just that.
 
@RMartinhoFernandes I see.
 
[
@classdaknokt thanks I got it
 
@MooingDuck does that also work with non-virtual classes?
 
11:32 PM
Though I should have a disclaimer my info may be outdated for about a week.
 
Their objects don't have a vtable.
 
@classdaknok_t it's UB if they don't have virtual destructors, so that's irrelevant (to me)
 
Release was scheduled for sometime now, I think.
 
@MooingDuck ok. :p
 
@classdaknok_t I guess a debugger ought to keep that info anyway. Just give all classes an empty vtable in debug mode to ID the derived type? I've heard worse ideas.
 
11:33 PM
Debuggers are there to find bugs, including UB. 3:
 
@MooingDuck No, it's only UB to delete it.
 
@RMartinhoFernandes ORLY? Did not know that.
 
It's perfectly okay (though questionable) to handle only a base pointer if you do the deletes with the most derived type.
 
@RMartinhoFernandes they should make it UB
 
@RMartinhoFernandes so if I have class A {}; class B : public A {}; A* foo = new B;, what would typeid(*foo); yield?
 
11:34 PM
@MooingDuck As an example, shared_ptr<Base> { new Derived } works fine.
@classdaknok_t The static type.
A is not polymorphic.
 
@RMartinhoFernandes so A?
 
Ok. I don't want that in my debugger. :p
 
But, if you add a virtual function to A (even if not a dtor), it gives the dynamic type, B.
@classdaknok_t I wouldn't mind.
A is not polymorphic, so there's no way that B's stuff matters in code that handles A*.
 
I'll try to make it catch new expressions and keep a table of pointers and types.
 
11:37 PM
@classdaknok_t what if they're nested? (placement new?)
 
What about B b; A* a = &b;?
 
The point is, for code handling A*, there's no B.
 
static_cast?
 
It just happens that there's some B data in adjacent memory, but that's memory the code can't access without casting first.
@classdaknok_t Yeah, and then the code has the correct static type. No problem there.
 
11:38 PM
The point is getting the data type given a pointer.
Which is very difficult in C++.
 
 struct crazy {
       char buffer[64];
       crazy() {new(buffer)std::string();}
       ~crazy() {reinterpret_cast<std::string*>(buffer)->~std::string();}
 }
 crazy* ptr = new crazy();
 
At best, I wouldn't think about making this work before the whole shebang is working.
 
two objects new'ed at the same address
 
Because it is highly unlikely to matter to the person debugging.
 
11:39 PM
@MooingDuck good idea. :P
I'll just start out with break points and stack traces.
 
@MooingDuck That's not crazy, that's an optional!
 
@RMartinhoFernandes eh, so it is
 
(Also, please use aligned_storage :)
(I think I admonished you for this before)
 
@RMartinhoFernandes point is: two objects new'd at the same address
@RMartinhoFernandes three or four times yes
 
@MooingDuck the last one wins.
 
11:41 PM
my question about if my "quicksort" is actually a quicksort or not on TCS has degenerated into a debate about the wiki page actually says about quicksorts lower bounds on extra space. Which is not relevant to the question.
 
Placement-new isn't a problem.
 
@classdaknok_t they're both valid and live objects
@classdaknok_t why not?
 
Oh wait now I see. :p
 
@MooingDuck I wouldn't care much about that either: that situation can only ever arise with T and char. The rest is most likely an aliasing violation.
So, just add the ability to see any data as a sequence of bytes.
 
@RMartinhoFernandes also unsigned char
 
11:43 PM
Yeah, the three chars.
 
@RMartinhoFernandes the whole point of his lua idea is to avoid that
@RMartinhoFernandes I don't think signed char offers the same guarantees about alignment (not that alignment is relevant here)
 
@MooingDuck But that's the only point of the code you have there!
@MooingDuck What guarantees?
 
@RMartinhoFernandes my point was that his workaroundn doesn't handle that case
 
The point of my Lua idea is to parse a tree of data members (not a sequence of bytes) into a human-readable format.
 
alignof(signed char) is 1.
 
11:44 PM
@RMartinhoFernandes new char has different alignment than new signed char.
 
@MooingDuck No.
 
@RMartinhoFernandes I can't find it now in the spec. I could have sworn....
 
For the any you mentioned before: the most straightforward implementation I can think of for any uses a any_impl* pointer and any_impl is a base class for any_impl_impl<T> (bad names, yeah) templates which implement virtual functions void* get() and type_info type() and store a variable of type T. I'm sure there are special cases all over and all, but it seems perfectly feasible to make it display properly, given the right amount of effort.
 
For example you have class vector : private _Vector_base<_T, _Alloc> and that's in namespace std::__std::__v1 and all that standard library crap. You don't want to read that; you want to debug your code.
 
§ 5.3.4/10 [expr.new] A new-expression passes the amount of space requested to the allocation function as the first argument of type std::size_t... For arrays of char and unsigned char, the difference between the result of the new-expression and the address returned by the allocation function shall be an integral multiple of the strictest fundamental alignment requirement (3.11) of any object type whose size is no greater than the size of the array being created.
that's what I was thinking of, I'm not sure it's relevant to anything
 
11:50 PM
This Clang talk is genius.
I might just switch compilers.
 
bye everyone and thank you very much for you're help
 
@RMartinhoFernandes right, I just said it's more effort than not having to deal with derived classes, because of the RTTI lookup.
 
No problem.
 
There's also lots of other differences between signed char and unsigned char, mostly dealing with whether or not something is.... memcpy able or something. Whatever that's called.
 
mehmcpy
9GAG is memecpy.
 
11:53 PM
anyway, going home
 
Später.
 

« first day (571 days earlier)      last day (4378 days later) »