« first day (413 days earlier)      last day (4537 days later) » 

11:01 AM
@ManofOneWay at least I've got you beat on free time...for now
@CatPlusPlus don't you quote the standard??? Is there anything more boring than that?
 
I never read it from start to end.
 
bad example
 
Even if I were, that doesn't invalidate my statement.
 
fair enough
 
@keithlayne Heavy in what context?
 
11:10 AM
template metaprogramming is a foreign beast to me...somebody told me like 15 years ago that c++ templates were turing complete but I couldn't guess at the time how to make it work.
@user411102 I should have maybe started with simple examples. If I went back and worked through the problems I'd probably grasp it a lot better.
 
@keithlayne you're good at recursion?
 
well, recursion I have no problem with
luckily I started studying CS with no preconceived notions, and that was the first concept I was taught
 
I never knew what's so hard about recursion.
Function calls itself, oh dear.
 
@CatPlusPlus it made perfect sense to me right off the bat, but some people seem to inexplicably miss it
 
@CatPlusPlus smart cat :) I had some problem getting tuned with recursion but now I'm ok with it.
 
11:22 AM
i found recursion pretty easy too -- and i started out with old-school basic (with the line numbers and all global variables etc etc). according to some sources, i should've been forever damaged by that...lol
 
Anyone here had problems with hard drives? Read sector errors? I lost my all partitions :(
 
you shouldn't lose all your partitions unless the bad sector was sector 0 (the mbr)
and in that event, you're kinda hosed. sure, you could get the data off with some tools, but that drive is no longer bootable, and sector 0 holds the partition table (unless your drive is set up for gpt)
 
I'm already trying some tools, but still no luck :(
 
yeah, you'd have to know where each partition starts and ends
which isn't terribly difficult to guess at...any sector that ends in 0x55 0xAA (or is it 0xAA 0x55?) has a chance of being a boot sector, which would be the first sector in a partition
 
@cHao I'm unaware of all these details :(
 
11:30 AM
@user411102 a buddy once told me to try sticking the drive in the freezer (inside a ziplock bag) for a while, then hook it up and try to get stuff off. I have no idea if it would work or not, but could be a fun experiment :)
 
what tool(s) are you trying to use to get the data off?
 
@cHao Get data back for NTFS
 
is it finding anything?
 
@cHao yes I think , it's showing big list of files now
 
(btw, you are aware that at this point, the only really useful option is copying whatever data you can retrieve to a whole other drive, right?)
 
11:34 AM
@keithlayne Thanks for advice , but Hard drive is at normal temperature like other Hard drives
@cHao Yes for sure:)
 
good :)
 
his point was that heat causes distortion on the platters, and can mess with the heads, and that could temporarily help you get data off the drive...I am just curious if it would ever actually work
 
@cHao read error at LBA=xxxxxxxxxx , what does that means?
 
11:38 AM
generally, a bad sector (or sometimes, a bad controller). LBA=xxxxxx means "sector xxxxxx"
 
sector xxx .... lol
sector xxx is a "bad sector" in everyone's hard drive
 
@cHao You know awesome amount of hardware and it's low lever details :D
 
> Now OK and TATA BYE BYE
 
@cHao and if that's the case , anyway to recover data of all partitions?
 
11:52 AM
generally if one sector's bad, there are other bad ones too. so you might not be able to get everything
but you'll probably be able to get the vast majority of it, assuming your tool's any good
 
@cHao It's showing files of one partition only out of three :(
@cHao professionals can do this for me?
 
yes...but they tend to be expensive
expensive enough that your typical "oh, i lost all my lolcat pics!" schmuck won't even bother
 
@cHao expensive?, I deleted that Idea from my mind now :)
 
they're more in the "the only copy of my company's source code is on that drive! DO SOMETHING!!!11!" range
meaning they'll rape you pricewise...but if the data's worth it...
 
@cHao My data worths $100000000000 :)
 
11:59 AM
well, then, you better come up off some cash. :)
 
IZ IN YER DISK, CORRUPTIN YER BOOT SEKTOR
 
btw, i'd like to take this moment to say, "have you backed up your data lately?" :)
 
@keithlayne your keyboard has got bad sectors also:D
 
(i won't give you too much shit over backups...i never do them either. but i should, and so should you. :))
 
@cHao yes , what ever files I am seeing , I am taking backup already
 
12:28 PM
Why does this flat-out wrong answer keep getting upvoted?
 
> But look at Kerrek's answer if you want a UB-free answer.
That is awesome
@KerrekSB humor me and explain why it's UB please?
 
"This answer is wrong, but it's shorter". Hm.
 
is it just the cast to non char pointer?
 
@keithlayne You are not allowed to access any memory through anything other than a pointer or reference of the correct type.
 
Yes.
@KerrekSB Or char*.
 
12:36 PM
@keithlayne Yes. The exception is that you can access anything as a char array.
For obvious reasons, namely I/O
 
Also, why nobody mentioned variant in that question, do I have to do that every time? :.
 
char is the language's primitive data unit, so you are allowed to decompose your data into it.
 
surprised nobody mentioned void*
 
@CatPlusPlus I think the OP just wants to use the integers as storage
@keithlayne How would that help?
 
Yeah, but that's silly and loses information about the type.
 
12:38 PM
@KerrekSB I would think it would do the opposite
 
How do you want to distinguish a float from an int when retrieving?
All float values are valid ints in this scenario.
 
aren't the C guys in love with void*?
 
And float is rather useless when used as an int.
Well, float bytes.
 
@CatPlusPlus I think the OP knows what he's got stored. Not sure. But I thought he just has a big int array and wants to use it to store floats?
 
@KerrekSB > But I have an allocated array of unsigned ints, and I occasionaly want to "store" a float in it.
Seems entirely useless to me.
Ugh, I need to go that damn shop.
 
12:42 PM
@CatPlusPlus Hm, yeah... well, we don't now the full story. Maybe he's reading many files, and for each file he has a separate criterion to tell whether something is a float or an int...
Why not post your variant suggestion?
@CatPlusPlus Me too actually
 
Comment. It doesn't really do what OP wants to do.
Only 6 degrees outside. :/
 
does anybody actually use unions any more?
@CatPlusPlus still no tea for you?
 
I'm out of food, mostly.
 
I need to make coffee. My boys are playing with Legos. Legos are awesome.
 
Minecraft!
 
12:46 PM
seriously, would any of you ever recommend using unions in C++? I think they're super icky.
 
boost::variant is a tagged union.
And doesn't suck, unlike the built-in one.
 
Way back in the day I was looking at the XFree86 source, and parsing the protocol relied heavily on heavily nested unions and structs. It made me want to puke.
@CatPlusPlus I can deal with that, but is there any reason they're still around other than C compatibility?
 
It's X. It makes me want to puke even without reading the source.
Dunno.
 
at some point they switched over to a much nicer way to do the parsing
 
cpx
Hmm.
If I include a static object into .cpp, it gets copy right?
 
12:50 PM
What do you mean by that?
 
@CatPlusPlus Speaking of revolting ideas
@cpx The copyright is always with the author of the code. Don't confuse it with the license.
@CatPlusPlus (I haven't even penetrated yet what that code is trying to achieve. Baby's First Free List?)
 
cpx
lol
 
@cpx do you mean is there an independent copy in each translation unit or something?
 
cpx
@keithlayne Yes, two seperate copies of a static object with same name.
 
@cpx I have no clue, I was just trying to understand the question :)
 
cpx
1:03 PM
Nevermind, I was being silly. :)
 
@cpx how can they be copies if they're separate and static?
 
@awoodland they are independent, right?
 
@keithlayne assuming you put static Foo bar; in a header file and then #included it in two or more TUs then they have nothing connecting them together
 
that's what I thought, thanks
 
(you might also be interested in anonymous namespaces)
which are essentially the same thing
 
cpx
1:11 PM
@awoodland Thats what I meant yes, each TU have their own copy of bar.
 
@cpx I'd say instance instead of copy there - copy seems to imply copy constructors or same origin or something, but they're two totally separate instances
 
cpx
Precisely.
 
1:42 PM
Man, I had a small piece of hamburger stuck in my nose after I laughed while eating.
Now I finally sneezed it out
 
1:54 PM
I'm reading about the libstdc++ extensions -- there's some great stuff! Debug iterators, debug containers, automatic parallelisation, unintrusive profiling and suggestions ("change vector to list")...
 
2:15 PM
Why doesn't C++ contain a runtime function to get the array size from a pointer obtained from new T[N]? It'd be cheap and easy. Then unique_ptr<T[]> could have a size() member.
 
MSVC has debug iterators, too.
 
@CatPlusPlus Yes, there's a whole ASTL episode about it
I thought they were the only ones. I was happy to see that GCC also has them
 
STLport has them, too, but it might be dead project by now.
And I suspect libc++ has them, or will have them in near future.
Apache's stdcxx has them, too. Also might be dead.
 
I mainly wanted to find documentation for the stuff in <ext/*>, but the documentation is pretty poor.
E.g. what's the interface of <ext/rope>? And of <ext/rb_tree>?
 
Rope might follow SGI interface.
Also, there were Doxygen docs built from libstdc++ somewhere.
 
2:32 PM
@CatPlusPlus Yes. It says "please write the documentation" :-)
 
But still, it should list public members.
Beats navigating through source.
 
I guess.
 
Though libstdc++ code is bit clearer than MSVC's standard lib.
 
@keithlayne Much better, thanks!
I had also hoped that there would be a trie class somewhere, but I don't think so.
 
2:34 PM
I told you about SGI interface earlier. :f
 
@CatPlusPlus The power of a link :-)
I'm not so familiar with the SGI thing. Is that a stable API?
 
SGI is where original STL came from.
 
Yes, but is it now in a quasi-standard form?
 
Dunno. Few times I looked there, it seemed to match the standard library at least in terms of interface.
 
@KerrekSB really? are you as young as the rest of these guys?
Am I the only one here that used the STL before it was part of the standard? You'd think I'd know more by now.
 
2:45 PM
sbi probably did, too.
 
@keithlayne I've certainly not used it :-) I know that it exists, but I'm not sure if it exists now in a maintained, stable form.
Any Javascript wizards around here?
 
I think they donated it
 
I wonder if someone could beef up the FPAs to include a "copy to clipboard" button for each <div class="listing">.
I.e. get element, prepend button, read element's "inner HTML" etc.
 
I'm microwaving lasagna. It said 10-12 minutes on 600W. I hope the plate doesn't melt.
 
@CatPlusPlus The "plate"??? That is your biggest worry?
 
2:53 PM
What else? I'd suspect the microwave can withstand 10 minutes of work on not-even-full-setting.
And I think the food itself is supposed to melt, otherwise they wouldn't put 10 minutes on the package.
 
@CatPlusPlus I'd worry about plastic containers. But plates are typically made for hot food, non?
 
Well, I don't know, I've never microwaved anything for more than 2 minutes.
 
It's not like you're putting the plate in an oven.
 
And there's a difference between putting hot food on plate and heating up food with the plate.
 
The microwave heats stuff selectively, so only the food itself gets hot. So, you just have the scenario of "hot food on a plate", which any self-respecting plate should support.
@CatPlusPlus Right. Don't put plates in an oven.
Who can penetrate this logic?
 
3:00 PM
The food melted all right. I hope this tastes better than it looks.
Also, I hope it's sufficiently heated up and I won't die or something.
 
@CatPlusPlus "heat" should also have a strong inflection, "heat, heat, heat". Like "beat".
I'm in favour of reintroducing irregular verbs to spice up the language.
@CatPlusPlus If you die today, can I get your rep?
2
 
No, I'm giving it all to cat charity.
 
do you like this music ?
 
I think I'll try to heat up next portion in an oven after all.
This one is all melted inside, and steel hard on the outside.
Oh, hey, QEMU 1.0.
 
@CatPlusPlus What's up tonight?
 
3:10 PM
Sky.
 
That was hardly fun the first time.
Come on
 
It's still funny to me.
Anyway, nothing is up.
 
No school assignment?
I'll have to write a design document =(
booooring
 
I have something, but I can do it later.
 
nice, when will you have christmas break?
 
3:19 PM
23-26.
Well, uni till 2, but I imagine there'll be stuff to do at work.
 
We have really long holidays, I believe I'll start again at 18 Jan
 
mornig
 
Morning?
 
Xeo
morning
 
cpx
morning
combo!
 
3:32 PM
You blew it.
Now I'm wondering if 'named tuple' can be made better.
 
Xeo
@CatPlusPlus ?
 
Xeo
Great, what have you done now @Cat?
 
man
I feel bad
 
3:39 PM
my flatmate left me a note
she only does that if she thinks I made a mess and didn't clear it up
 
Xeo
Damn cats, too adorable.
 
It's certainly Boost.Preprocessor-able, but I wonder if it can be made prettier in raw code.
 
Xeo
llvm[4]: Linking Debug+Asserts executable clang
collect2: ld terminated with signal 9 [Killed]
-.-
not funny, second time it just got killed for no apparent reason
 
3:53 PM
std::tuple-related errors take half the screen each due to it having fixed number of template arguments.
 
4:06 PM
I'm innovating here, and nobody cares. Pfft.
 
lol
probably because tuples are horrifically uninteresting
in virtually every way imaginable
 
Tell that to Fusion guys. Looks like they have a named tuple, too.
 
eh
Fusion can do whatever it wants
that doesn't mean that I have to care about it
 
@CatPlusPlus Yay for named tuples :-)
 
4:27 PM
@KerrekSB Because the "size" of a dynamically allocated array might be bigger than what you requested via new T[n].
 
cpx
does the linkage of non-static data members of class mentioned anywhere?
 
I don't think linkage applies to non-static members.
 
@FredOverflow But the runtime has to know n anyway to know how many destructors to call
 
Xeo
Yay, out to get my certificate "Game Programmer" \o/
 
@DeadMG only for non-PODs
@Xeo What games have you programmed yet?
 
4:35 PM
true
 
Xeo
@FredOverflow School projects. :P We had to do 1 game each semester, assembling ourselves into groups
 
So what games were those?
 
Xeo
1st semester was a space invader + guitar hero mix/clone, second was first-person shooter, third was a wii game, and fourth an MMORPG
We can choose what game to make
 
Programming a MMORPG in one semester? WOW.
 
Xeo
Well, no. :P
 
4:38 PM
In the end it was only G.
 
cpx
@Xeo Did you have to read books on game programming i guess? :/
 
Xeo
The project was underway for 2 years already by one of our seniors
 
@cpx Not necessarily. Game programming is just a special form of programming.
 
Xeo
@cpx Not really, we learned that stuff in the projects themselves. :)
The lessons weren't all that helpful actually.
The most stuff we learned came through the projects
 
cpx
oh i see
@FredOverflow Can i assume "No linkage"?
 
Xeo
4:40 PM
omg
 
@cpx When you define non-static data members inside a class, those definitions don't actually reserve any memory. So yes, I would say no linkage, but I'm not a linkage expert.
 
Xeo
thanks to some roadwork, my way to school today takes 1 hour instead of 25min
OMG
fuck, and the awarding is at 7pm. 5:40pm now... oh boy -.-
Fuck, I'm out, see ya
 
I see your time planning is as good as mine.
 
@KerrekSB were the gnu extensions you were talking about all documented in the "extensions" section? It looks like there's other useful stuff sprinkled about.
 
@keithlayne They're documented to varying degrees. Some sections just say "see the doxygen for details" :-(
@keithlayne The various allocators look very useful
@FredOverflow How do you mean? Every compiler must have a way of knowing the array size.
 
4:54 PM
yes, but because of alignment, etc, the size of the memory chunk is not necessarily the same as the array size
the compiler only has to know the exact array size for non-POD types to call their destructor
 
5:05 PM
@DeadMG So you mean that for PODs the array size might not be known at all?
 
yep
 
Shame.
 
In the simple world, it would just remember n somewhere.
 
the compiler only has to know the size of the memory chunk to deallocate it
which isnot the same
 
I guess unique_ptr is the only part of the standard library where the array allocation function is ever mentioned.
All other containers make the element size explicit anyway and just use the scalar allocator.
 
5:07 PM
Raw arrays are not very useful, anyway. Especially dynamically allocated ones.
 
@CatPlusPlus The only situation I can imagine is when you want less than a vector, so you just use unique_ptr<T[]>
 
But what's "less than vector"?
Vector is already just a dynamic array.
With the advantage of iterators, knowing the size, and being resizeable.
And now that we have initializer_list, creating it on the go is as easy as raw array, so I really can't see where raw array would be more desirable.
There's even no problem with interop thanks to contiguity.
And there's also std::array which doesn't decay to nigh useless pointer, losing the size information like a bucket without the bottom.
Really, raw arrays are just implementation detail of useful stuff now.
4
[/rant]
 
@CatPlusPlus Well, if you never need to resize it, but you only know the size at runtime.
 
Then just don't resize.
 
Something like a constant vector with mutable iterators...
Why not: struct Holder { Holder(size_t n) : p(new int[n]) { } std::unique_ptr<int[]> p; };
 
5:15 PM
I don't see a problem with vector being resizeable if you never resize it.
2
 
5:28 PM
does std::find work with std::map ?
 
@TonyTheLion std::map has a member function find that is much more efficient.
@KerrekSB If you say new int[3], it's totally possible that the runtime system will actually allocate (and later release) space for 8 integers instead.
 
I was at the Ronneburg today
 
@CatPlusPlus Some people seem to believe that if a class offers some functionality, it must be less efficient than a simpler class that doesn't offer that functionality, even if you never use it.
 
Some people seem to believe Perl is a language.
 
@FredOverflow I think != must, but may
 
5:41 PM
To be fair, vectors store a size and a capacity, whereas a non-resizable vector could do away with the capacity.
But then you would always have to initialize all elements when creating the non-resizable vector. You wouldn't be able to push_back.
 
It's only memory optimisation, which would only be noticeable if you have a lot of vectors like that.
 
if you limit yourself to 32bit sizes and capacity on a 64bit system and to 16bit sizes and capacity on a 32bit system then you too can end up using only two pointer spaces
 
@CatPlusPlus What is Perl, if not a language?
 
I think with the vectors it's usually other way around — relatively low amount of containers, lots of items.
@FredOverflow Noise.
 
@FredOverflow oh cool
 
5:43 PM
have this weird problem...have a base class A and a class B inheriting A whose members are private. Friend function of B cant seem to access protected members of class A
 
So they're private or protected?
Private stuff is not inherited at all, so it's not in B.
 
protected duh
 
Well, not visibly inherited may be a better wording.
 
private stuff is visibly inherited
 
sorry about that...
 
5:45 PM
Then make it a friend of A.
 
what do you mean by is visibly
may i ask, in real life , do we even use friend function/classes?
need it for b also
 
Sometimes.
Then make it a friend of both.
 
you can do that?
thanks :D
how do i rep you lol
oh yeah btw...any good way of connecting sql to c++ programs?
and i also wanted to know about some neat 2d graphics libraries
 
If you want to draw arbitrary things then OpenGL or DirectX. Well, or GDI+ if you don't need acceleration and use only Windows.
 
well, just want to make somewhat of a nice tabular grid type thing for displaying data
and could you guide me on mysql for c++?
 
5:50 PM
Then you probably want a GUI library.
 
Qt has both GUI and database stuff.
 
google it
 
5:51 PM
thanks for the help appreciate
it
1.6 gb thats alot
i like the api and stuff , really neat but is there any other standard thing out there?
i mean something more windows style
 
cpx
@anonymouslyanonymous sqlapi.com
 
good morning afternoon evening, world!
 
ewww
 
6:30 PM
What do you think of ropes? The doc says it "should be the default class for strings".
 
sounds like an interesting concept
ok I just googled "merking", damnit
 
@TonyTheLion Maybe like deque should be the default dynamic array?
 
what is it now, I didn't read it the entire thing?
 
No, deque doesn't allow random access.
It's good for stacks and queues, but doesn't replace arrays in any way.
AFAIK ropes work best for very long strings.
 
best answers for an assignment
haahhah
 
6:42 PM
@CatPlusPlus Whuwhat? How does a deque not have random access?
 
How do you implement a deque with a random access? It needs O(1) insertion on both sides.
 
@CatPlusPlus Like std::deque!
 
hmmm, so std::map<T,T>::find only finds the key, but I need to find the value, does it mean I have to write the search myself?
or is there some other way?
 
@TonyTheLion find() finds the entire value
 
6:44 PM
"value" means "pair(key, mapped_type)"
Oh, wait, you want to traverse and search by mapped type?
Use Boost.Bimap
 
the signature looks like this iterator find ( const key_type& x );
 
Use Boost.Bimap
 
key_type refers to the key of the map I think
hmmm ok
 
(I will literally say nothing else to you until you accept this.)
 
Well, okay, so it has random access. But no contiguity.
 
6:46 PM
lol, but my map only contains 9 values, I can just write a loop to find what I need
it isn't gonna affect anything
 
@TonyTheLion Use Boost.Bimap.
@CatPlusPlus We never argued contiguity, though. Did you need that?
 
right
 
I never argued anything, I thought deque is typically a linked list. :P
I guess it could use array-backed storage.
Contiguity is nice for interop.
 
@CatPlusPlus how?
 
@CatPlusPlus Well, the argument was about "default dynamic array". One could discuss whether contiguity or cheap reallocation is the preferable default trait
@CatPlusPlus Vectors certainly have their place when contiguity is required, but the question is whether that's the "typical" requirement for a dynamic array.
Deques never need to move elements, which might be a plus
 
6:50 PM
I certainly have never written something where contiguity was a specific requirement
 
@TonyTheLion You can do &v[0] and pass that to things that use C arrays.
 
oh right
 
I never really thought about deques too much.
Nobody told me it has random access. I feel stupid now. ;(
 
If I'm writing a C++ library, and I pretend to want to easily add a C interface later (I have never done such a thing so I don't know what issues I'll run into), is it better to use member functions or free-standing functions with a ref parameter to the class it would otherwise be defined in? I would guess the freestanding function can easily be adapted to accept a void* to the hidden raw C object thing that simulates a class for the C layer.
 
@CatPlusPlus An underappreciated gem.
 
6:54 PM
@rubenvb Make a C++ library. Then worry about C interface.
For C wrappers you can use an opaque handle.
 
Sooo tempted to paste an FPA for this question.
 
7:06 PM
@CatPlusPlus OK, I'll focus on getting at least that design straight :)
 
7:28 PM
@KerrekSB access is noticeably slower than with a vector, though
 

« first day (413 days earlier)      last day (4537 days later) »