« first day (410 days earlier)      last day (4540 days later) » 

5:00 AM
looks right
 
OK
 
Initialize the vector in the initializer list
 
If you're not just writing Array<T> for fun - have you considered boost::array? boost.org/doc/libs/1_48_0/doc/html/array.html
It's essentially a constant-sized vector
 
Can Boost be used commercially without a fee?
Looking up license...
 
it's not just for fun...he's trying to take over the world
@IDWMaster yes, it's mostly header-only
 
5:03 AM
Yep, Boost is free for any purpose.
 
OK
 
Oh, you're trying to make money with this?
 
No. I'm licensing it under LGPL
 
So all associated libraries must be applicable to those terms
 
5:04 AM
@rvalue C++11 has a std::array, which is essentially boost::array in a different namespace.
 
"The Boost license encourages both commercial and non-commercial use." boost.org/users/license.html
 
Since I already started writing (again) using std::vector, what is the vector::reserve for? Does it reserve memory in bytes, or in terms of sizeof(T)*n?
 
@EtiennedeMartel Which is quite handy - a lot of C++11 (and TR1 before it) was originally part of Boost and/or referred to boost implementations in the spec.
For maintainability, I tend to make a project namespace with typedefs for whichever ones are available on the platform
 
@rvalue Yes. It shows that without Boost, C++11's library additions would be quite anemic.
In fact, I'm not even sure there would be a C++11 without Boost.
 
Getting latest SVN of Boost
 
5:07 AM
@IDWMaster reserve is a number of elements - note that an implementation may reserve space for more than required, but it will have storage for at least arg elements
 
"the so-called point free style (also called the pointless style)" :-)
 
@rvalue So it's in number of elements, not bytes.
 
@IDWMaster yes
 
reserve guarantees that the vector's capacity is going to be at least what you specify
 
Beware the reallocation penalty of std::vector, especially in collections that grow frequently; also note that removing elements has no guarantee of freeing up the space they occupied.
std::deque can often be a better choice for truly dynamic-sized collections where random access is still important
 
5:13 AM
std::deque has guaranteed random access?
 
My Array<T> class is similar to C#'s Array class, so fast dynamic access is not necessary
It will be necessary when I implement List<T> but not Array<T>
 
@Pubby Yes, I think it also specifies that it runs in amortized constant time - it just won't be as small a constant as a std::vector
 
@Pubby std::deque is a kind of compromise between things. e.g. it's not contiguous.
 
@IDWMaster Oh, so it does not grow then?
 
@EtiennedeMartel It can be Resized, but is not intended to grow frequently
It's optimized for fixed-sized arrays, but can be resized (and reallocated) when necessary
Similar to the way it is done in .NET
With Array.Resize
 
5:16 AM
Hm, I think Array.Resize creates a new array and copies the data
 
Array.Resize is NOT very fast in C#
And will NOT be much faster in C++ either
 
@EtiennedeMartel As does std::vector when it grows
 
I'm implementing the BCL in C++ similar to the way it is implemented in .NET
 
Why exactly are you porting .net's containers to C++?
 
And that's how the .NET BCL does it
 
5:17 AM
@rvalue unless it's smart about it and the data is POD and it's lucky
 
I'm re-creating Mono for Android
And other platforms
 
Isn't that... Mono?
 
In C++? What?
 
A C++ implementation of the BCL without .NET
Uploading latest version now
Done
 
This is gonna take a while. The BCL is huge - larger than the STL
 
5:18 AM
Isn't BCL for C#?
 
Array.h now uses std::vector
@Pubby Doesn't have to be
 
@Pubby It's the standardized part of the .NET Framework
 
I'll make a nicer version of that now using System::IO::BinaryWriter....
 
I don't really understand the purpose. How is that better than the std?
 
@Pubby I wouldn't want an STD no matter what.
 
5:20 AM
Technically, it has a larger scope, but the problem is that .NET isn't quite useful without the non-standard libs such as WinForms, ASP.NET or WCF.
 
I have to question the motivation at this point; if somebody wants to use BCL classes in C++ code, they have stl mirrors for at least all the containers. If they have a large .NET codebase that must be used verbatim, they should most likely use .NET
 
@rvalue Unless you're trying to port it to platforms that can't run .NET
 
... not that I don't have similar projects myself ^_^
 
@Pubby i think much can be made better than the standard library, e.g. immutable strings and vectors with custom deleters and so on (not to mention iostreams). but it would be a huge effort. many people
 
5:22 AM
Can't port Mono to those platforms easier?
 
@rvalue No
Can't get Mono to compile for Android.....
 
@IDWMaster Still, I don't know why you would use that instead of plain vanilla ISO C++ (plus perhaps Boost)
 
@EtiennedeMartel Write apps once, run everywhere. That's my goal.
 
@IDWMaster C++ then. Or Java if you like pain.
 
@AlfPSteinbach I completely agree, but I don't think BCL is much better, especially for C++. I've been working on a library that's a replacement, but have been running into the same problems as IDW
 
5:24 AM
C#'s lack of const semantics makes everything weird in the BCL's collection classes.
 
@Pubby My library's open-source. You're welcome to contribute if you like
 
If the apps haven't been written yet, they should be written with the interface appropriately separated from the logic/engine such that a native interface can be developed for each platform.
If Windows Phone has taught us anything, it's that using the same interface on different platforms sucks balls on all of them.
2
 
@rvalue Actually, Java taught us that
10 years ago
 
Java can't run on Windows Phone though....
YET.....
 
True, RIP java::awt
 
5:26 AM
@IDWMaster Yes, but who uses Windows Phone?
 
I might do that sometime too
@EtiennedeMartel I do, and I figured I'd make some apps for it as well since I already have a large .NET codebase
A lot of my existing code was able to be ported over to the phone fairly easily
 
@IDWMaster Yeah, I figured you were a .NET developer
 
@EtiennedeMartel I'm looking for native solutions to run my .NET code on more platforms
 
I think you'll be better off porting your .NET code to C++ than porting .NET to C++
 
C++/CLI!
(Just kidding)
 
5:27 AM
ATL!
 
@rvalue I'll port .NET to C++ first, then make a IL interpreter
 
wheee~
 
Native code can't run on Windows Phone....
 
IL compiler in LLVM?
 
For 3rd party devs
 
5:28 AM
This project is doomed.
 
What? HAHAHAHAH
At least both the Windows Phone users only want to run Outlook.
 
Anyway, Android is going to crush everything if it can survive the legal attacks by its competitors (because as we all know, if you can't compete, litigate).
 
android is awesome...except for that decision about Java
 
Yeah, but it's not really Java.
They don't implement the full library, and they have their own JVM
Still, I think they should have gone with Python or something
 
I kinda like the "each process in it's own vm" concept.
 
5:33 AM
Python on a phone sounds slower than molasses
 
doesn't have to be any slower than anything else
 
Building for .NET has always been going to tie you to MS platforms. If you want to write portable code, you have to sart with a language that runs on the platforms you want to run on. If you don't know what platform you want to run on, you have a lot of design to do before you code.
 
but yeah, I agree
 
If you need to write a portable platform first, you've got to have deep pockets and a near infinite timeframe for the projects that rely on it. Microsoft can do it. Sun can (well... could) do it. I pray every day that Adobe (read: Macromedia) never get there.
 
@Pubby They don't have to just put CPython on there, you know
 
5:36 AM
The reality is that language hasn't been the driving factor for program performance in over a decade.
Programmer productivity makes the language, and entrenched enterprise code keeps it in the shortlists.
 
I just love me some COBOL
 
Someone should make a language whose statements are defined by execution time, not what they do
 
@keithlayne Kobold?
 
@Pubby brainfuck++?
@EtiennedeMartel quick googling tells me you just went over my head
 
I'm awesome
 
5:38 AM
A programmer that makes good decisions about scalable data structures and algorithms and uses an appropriate language to get the job done is going to cost his business some $100k/a in salary. Compared to that, server clusters are cheap.
 
@keithlayne I prefer cpl
 
a school I was attending threw out this IBM mainframe contest that sounded interesting. Another corporate "partnership" thing.
You got to do exciting stuff with COBOL!!! yay.
 
New array class causing mysterious BinaryWriter crashes
 
It's probably not that mysterious.
 
5:40 AM
it was really a scheme to make kids excited about learning something that would make them competitive for the crappiest jobs in the world.
 
Yeah, I heard COBOL was quite a piece of shit.
 
they say how a bazillion lines of cobol are in use today, running all kinds of industries
 
Yes, because it's been around for so long that there are no more bugs
 
it's true I guess but I would commit suicide if I was just maintaining shitty code in a shitty language every day
 
Banks don't want to switch to something else when what they got works perfectly well
I heard COBOL programmers are paid perplexingly well
 
5:42 AM
Original FORTRAN has to take the cake for surprising behaviour; by allowing assignment to 'variables' with numeric names.
 
hazardous duty pay for the aforementioned risk, I guess
 
2 = 2.5
Awesome, now 2 + 2 == 5
 
@Pubby I'm switching to cpl for all my projects now, thanks
@rvalue if someone wants to give you a project, how do they assign it to you?
 
"An unhandled win32 exception".....
 
@IDWMaster Debug assertion failure.
Grab your debugger and goooo!
 
5:46 AM
@EtiennedeMartel Wiki says that the kobold has survived to modern times through folklore...just like COBOL?
 
Succeeding in making a program that can't be killed by task manager...
End process doesn't even work!
Need to go now though
Bye
 
@keithlayne I'm not sure I understand - what kind of project do you mean?
 
I can't for the life of me assign anything to an rvalue
 
oh, hurr
xD
 
I'll be here all night...be sure to tip your waitress.
 
5:50 AM
I guess operator=(rvalue&&) would work - I'm not const
... but I'd forget it when I went out of scope.
 
sbi
To the 99% of C++ programmers who are not C++ experts: occupy WG21! Really, you can just show up. We'd love the feedback.
 
@rvalue I'm still in C++03, your comment does not parse for me.
 
Alright, it's one in the morning here and I need to get some sleep. See ya everyone!
 
later dude
 
later
@sbi I stand with the 99%
 
6:00 AM
@rvalue hanging out here gives me that feeling
I might have to ask a question on SO
that sucks
@FredOverflow you're a Haskell lover, right?
 
@keithlayne quiet admirer, yes
 
to me, quiet admirer == stalker :)
 
Do you have a stalker? :)
 
Not anymore...wait, is the FBI monitoring this?
 
@keithlayne Sure you can assign to an rvalue: std::string("hello") = "world";
 
6:03 AM
I was wondering about converting a simple function to point-free style
 
@keithlayne If in doubt, ask lambdabot.
 
@FredOverflow you don't have to rub in the fact that I suck at C++ with the fact that I'm not funny
@FredOverflow what is this lambdabot you speak of?
ah, I see "pointfree refactoring"
what I really want to do is make a tree and fill the root which will lazily imply the whole rest of the tree. I don't think I've read enough yet.
 
later all
 
6:22 AM
@FredOverflow std::vector<int>().swap(numbers); is a way to clear the numbers vector and also have it release it's memory.
 
Are you telling me or asking me?
 
I don't know.
I just woke up and I don't know what I'm doing.
 
Using RAII instead of raw pointers prevents resource leaks.
An apple a day keeps the doctor away.
 
@FredOverflow Lol I was just going to say that!
 
Better to have compiled and failed than never to have compiled at all.
Hm, doesn't really make sense.
 
6:25 AM
Some people never compile.
 
poor bastards
 
At my workplace there's a copy of "Thinking in C++" laying around. I opened it and read: "temporaries are always const".
Not a good first impression.
 
Maybe a very old edition?
Confusing rvalues, temporaries and const seems to be quite common.
 
I don't think so but I'll check.
 
Thinking about temporaries as being const doesn't hurt too much in C++03, but it wouldn't make any sense in C++11.
@StackedCrooked Although the swap-trick wouldn't work if temporaries were const, of course.
 
6:31 AM
I think I remember now why I mentioned the swap trick.
 
So does Thinking in C++ mention the swap trick?
 
what are temporaries exactly? function returns? temporary constructed objects?
 
Not that I know of. I learned it from a recent Koenig post in DrDobbs.
 
@bamboon look here :)
15
Q: Lifetime of temporaries

frunsiThe following code works fine, but why is this correct code? Why is the "c_str()" pointer of the temporary returned by foo() valid? I thought, that this temporary is already destroyed when bar() is entered - but it doesn't seem to be like this. So, now I assume that the temporary returned by foo(...

> A temporary object is destroyed when the full-expression that lexically contains the rvalue whose evaluation created that temporary object is completely evaluated.
That's what I wanted to say :)
 
@FredOverflow ok thanks, i gtg now, but I will come back with a question concerning this topic later this day
 
6:39 AM
@FredOverflow ah, lamdabot is cool...my function even comes out not-so-ugly when I run pl on it. I just don't understand how it works so much :(
it seems pl is easily confused and gives back illegal results
 
Let's just say pointfree doesn't always make your code easier to understand ;)
 
@keithlayne The CIA and FBI are both monitoring this room, as well as numerous other ... organizations. No one ever knows when a C++ programmer will blow themselves up.
 
The STL and the MFC?
 
@muntoo I've said too much then...see you in 20-life.
 
But first and foremost, the TLA ("three letter acronyms"), of course.
 
6:51 AM
The 10-20-Life law (Florida Statute [http://www.leg.state.fl.us/statutes/index.cfm?mode=View%20Statutes&SubMenu=1&App_mode=Display_Statute&Search_String=775.087&URL=0700-0799/0775/Sections/0775.087.html 775.087]) is a mandatory minimum sentencing law in the U.S. state of Florida. It primarily regards the use of a firearm in committing a violent felony. The law's name comes from a set of three basic minimum sentences it provides for. An ongoing public service announcement campaign has accompanied the law since its passage under the slogan, "Use a gun, and you're done." Background As of 199...
That's dumb.
I can't legally shoot anyone in Florida.
 
Not even your own foot?
 
@Fred for example, if you have a type ambiguity...I want to map read over a list of int strings and get back a list of Ints...I can't seem to do it without a lambda or simple function that just adds the type constraints. pl \x -> read x :: Int gives me (:: Int) . read, which seems to be illegal. :: doesn't seem to be an operator, I feel dumb.
 
@FredOverflow Only if you are on the beach. (Get it?)
 
@Muntoo are you in FL?
 
@keithlayne No. (I hope.)
 
6:55 AM
it's the only place I know where there are so many hot girls that even nerds get hot chicks regularly. <packing bags>
 
It is also where many terrifying natural disasters happen and are waiting to happen.
 
sbi
@muntoo Wow, 30k+ times a gun used in felony in one year. I bet that's multiple times as many as in the whole of western Europe.
@keithlayne Aren't married and have kids?
 
@sbi yes...you forgot that I'm never serious. I think it's in the newbie hints.
 
sbi
@keithlayne What, the newbie hints make you think of hot girls in Florida? A true nerd, eh?
 
@sbi pretty much everythong makes me think of that.
freudian slip?
 
sbi
7:05 AM
A Freudian Slip is when you say one thing, but mean amother.
 
@sbi Wikipedia says "In general use, the term 'Freudian slip' has been debased to refer to any accidental slips of the tongue.[1]"
 
I found out a little while ago that Dennis Ritchie died a week after Steve Jobs. :(
 
7:26 AM
@StackedCrooked you use Scala?
 
8:20 AM
figuring out at moment..
 
 
1 hour later…
9:34 AM
@keithlayne Nope.
 
Morning
 
morning all
 
cpx
mawning
 
10:07 AM
what's a logical size for pid_t on Windows?
 
what is pid_t
 
pee identifier, of course
for tracing who peed in a person's swimming pool
 
lol, POSIX's process id type
I'll just use __int64.
 
cpx
sizeof(pid_t)
 
it's only for winpthreads+MSVC, so I can continue libc++ porting to MSVC
 
10:13 AM
why can't you just use, you know, pid_t?
isn't that what it's for?
DWORD, if you want to match what the Windows API uses
 
@jalf: ah, I'lll mention that to mingw-w64 devs
 
I know, looking things up in the documentation, crazy talk. ;)
 
@jalf: well, could've been some precedent, and obviously not on msdn, as msvc doesn't have pid_t.
 
but it does have process id's ;)
btw, is libc++ the clang one?
I always get those similar-sounding names mixed up
 
yeah, it's libcxx.llvm.org's libc++ :-)
I've already gotten it half-working for MinGW-w64.
 
10:21 AM
ah right, nice :)
would love to see that working on MSVC
 
as in, I ran the tests and only ~10% failed, with a lot of failures due to Clang not doing exceptions right.
 
oh yeah, what's the status on that? Some major redesign going on, wasn't there?
 
Working on it :) It'll be stripped of some type_traits features though (namely is_constructible and common_type will be missing)
 
with how exceptions are implemented, I mean
 
Don't know, I only know Windows has been left out in the cold
LLVM doesn't do x86 setjmp-longjmp exceptions like GCC can, and the Win64 implementation is incomplete
Win32 needs a MSVC-incompatible dwarf2-like scheme, like GCC, I guess, because the MSVC-exception handling is patented
but Clang (without exceptions) works pretty well with MinGW-w64 and GCC's libstdc++.
on the MSVC side, work is being done to parse Visual studio headers (which mostly works now), but C++ is still off-limits due to name mangling issues (ie undefined references to the standard library)
That's everything in a nutshell :)
oh yes, dllexport'ing a class isn't implemented yet either :(
I'm not fit to fix that, I suck too much at C++ :)
 
10:27 AM
quick question guys...
in order to add to a vector using the += operator with a custom class
do i need to overload an operator?
I'm trying to do something like:

std::vector<MyClass> classes;
classes += MyClass("params");
 
@TheRarebit what do you mean by "add to a vector"?
 
you kno how you can use that += operator to add to a vector quickly? e.g.
std:;vector<int> Ints;
Ints += 1, 2, 3, 4, 5;
 
again, what does "add to a vector" mean?
append elements onto the end of the vector?
or add a value to every element in the vector?
 
yeah soz
append to the end of the vector
 
And the fact that I had to ask should tell you that this is a terrible, evil idea
Don't abuse operator overloads to do things that aren't 120% clear and obvious and intuitive
just call insert or push_back like normal people do. ;)
that way, people can understand your code
 
cpx
10:31 AM
why not push_back?
 
hmm fair point
yeah I could use that, was just wondering if it was possible using the += operator
 
it'll cause more confusion than it's worth, trust me. :)
there's a reason why a lot of languages prohibit operator overloads completely
they can be overused easily, yielding "clever" code that just doesn't make sense
 
@jalf: like C?
 
I was thinking of Java
 
okie dokie
 
10:33 AM
lol
 
cheers for the advice :)
 
no problem. :)
 
cpx
I doubt if you can do that even with overloaded for +=
Ints += 1, 2, 3, 4, 5;
 
oh yeah, that's the more interesting part of the question. C++11 adds a lot of features for more easily initializing containers (and other objects). If your compiler doesn't support that yet, you'll either have to add elements one at a time, or construct a temporary array to copy from, or perhaps use something like Boost.Assignment
 
The only time I've actually used the operators on specific custom types are when using matrices and vectors in linear algebra
 
10:42 AM
how about Boost.Filesystem and operator/?
that's a classy example :)
 
These LR(1) parsers are *** nasty to construct
 
@rubenvb yeah, that's neat imo
since it actually clarifies code, instead of just making it look "cute"
 
 
1 hour later…
Xeo
11:54 AM
@cpx It works with Boost.Assignment
 

« first day (410 days earlier)      last day (4540 days later) »