« first day (635 days earlier)      last day (4314 days later) » 

Ell
11:00 PM
right.
 
having Unicode codepoints interface only is best
 
@DeadMG Oh duh... you are right... I use typedef because I don't like to go around using the struct keyword... sorry.. brain fart.
 
lets you skip a lot of the coding problems that C++ had
@JimNorton Heh. That's OK. All I'm saying is that in C++, a struct is a type automatically and you don't need the typedef.
 
@DeadMG unicode, eh? so..will I need a chinese keyboard to use wide?
 
11:03 PM
of course not
 
can we have a pile-of-poo operator?
 
no.
 
:(
 
Ell
right so what will be in the core lib?
 
I just like to use typedef struct in C so I don't have to use struct when declaring variables and function protoypes etc... I hate this:

#include <stdio.h>


struct s
{
int a;
int b;
};

int main( int argc, char *argv[] )
{
struct s x;

x.a = 1;
x.b = 1;

return( 0 );
}
 
Ell
11:04 PM
and will there be GUI or anything in standard lib?
 
right now, everything that's in the C++ core lib (but done better), plus some extra goodies like gui, network, serialization
 
Ell
or will it mostly be essentials
 
@JimNorton Yeah, I know that sucks. But C++ frees you from that problem
 
Ell
yay sounds cool
 
proper Unicode support
also custom allocators and much better concurrency
 
Ell
11:06 PM
what's the GUI gonna be like? native widgets?
 
yeah, the simple stuff
 
@DeadMG And many other problems I'm sure. Which is why I'm trying to learn C++. Wow, what an incredible brain fart I just had.
I was thinking this:

struct
{
int a;
int b;
}s;

When I said struct { }; instantiated a variable.
 
yeah, only when you have s on the end.
 
@DeadMG Yep, that was the brain fart.
 
Could anyone take a look at my problem? stackoverflow.com/questions/11462021/…
 
11:10 PM
@Alec have you asked an SO question?
 
@CheersandhthAlf Yes
 
user406009
@Alec First comment is the answer.
 
@Alec If I was going to look at problems, I'd be viewing the questions list, not being in the chat
 
@DeadMG Sorry.
 
@Alec The comment is a good answer. The only answer so far is ungood.
 
Ell
11:11 PM
@alec its okay alec, its okay. Shhh sh sh sh sh sh Shhh
how are endianness problems solved? I.e. bytes over network. or aren't there any?
 
networks always are big-endian
as for reading from file, I give an endianness to constructor
 
Ell
because you can't detect endianness from a file can you?
 
@Ell by being careful. If both ends are guaranteed to have the same endianness, you can just send your data as is. If you need to handle clients with different endianness, you'll typically convert everything to network order when sending, and convert back if needed when receiving
@Ell Of course not. Unless the file includes the information about what endianness its data contains
 
Ell
right so if you know that both ends are the same endianness you don't have to do anything? e.g. x86 to x86?
 
yeah
 
11:16 PM
@Ell right
 
@DeadMG the robot might be motivated to use wide if you included endianness-casting :D
 
but of course, the network packets and stuff would have to be network-endian
 
@DeadMG why?
The network doesn't care
 
because the routers who route your packet are gonna expect the address to route it to to be in big-endian.
 
I think it might care if it can't read the packets destination :p
 
11:17 PM
sorry, I meant, the packet header and stuff
 
oh, right
 
user406009
@Ell You might want to look at the standard functions used for this (linux.die.net/man/3/ntohl). I think Windows has them too.
 
but that's kind of a separate issue
Unless you're writing your own network driver, I don't think you need to worry about that ;)
 
Ell
@deadmg are you using streams for io?
 
eh
 
Ell
11:19 PM
I like how you can just get a network stream in .net
 
well, yes.
 
Ell
I dont know, there could be alternatives I don't know of :L
 
"stream" is a pretty vague and fluffy word though
Practically anything that wraps a TCP connection is going to be a stream of some kind
 
call it io rivers instead. sounds faster
 
besides the truth is that stream over a network is kinda misleading.
 
11:20 PM
I'm surprised std::string doesn't have a strip type member function that strips out beginning and/or ending white space.
 
Ell
well I just mean that its nice to have a consistent interface
 
you can't just take out whatever you want, and the end user controls what they all contain.
 
Ell
I like just calling it an IO, anything that is an io can be read or writren
 
@JimNorton I could be mistaken, but could it be called trim?
 
but it's a convenient interface
 
11:21 PM
@melak47 The document I'm looking at doesn't seem to include it... maybe it's outdated.... back to google
No reference to it here: cplusplus.com/reference/string/string
 
80
Q: What's the best way to trim std::string

Milan BabuškovI'm currently using the following code to right-trim all the std::strings in my programs: std::string s; s.erase(s.find_last_not_of(" \n\r\t")+1); It works fine, but I wonder if there are some end-cases where it might fail? Of course, answers with elegant alternatives and also left-trim solut...

seems there isn't
 
eh
why would std::string provide such functionality?
it's trivial to write your own and has no access requirements.
 
Ell
but its a useful function
 
It'd be nice if the standard library provided it. But it doesn't need to be a std::string member
 
@Ell So is every other function I write in my program. That doesn't mean it should be Standard.
 
Ell
11:24 PM
i always think the c++ library should be more rich, like with starts with and ends with and replace and all that
 
@Ell It should. But virtually all of it should be free functions, not members
 
Ell
why? if it logically fits as a string, why make it a free function?
 
@Ell Because member functions are bad.
 
@Ell because it's better design. Because then it's reusable
 
and trim doesn't need any special functionality to make it work.
for example
 
Ell
11:26 PM
but it is related to the string, what else would you use it for if you can only pass it a string?
 
@Ell But you can't just pass it a string.
what if I write a rope?
or any other arbitrary container of Unicode codepoints?
 
I want it it to be in C++ string because I like how nice it is to use in the C# String class.
 
@JimNorton buy would it be less nice to use if it was a free function?
Is trim(s) less nice than s.trim()?
 
std::string is one and exactly one thing: a range of codepoints, and nothing more, and trim should not be tied to it any more than sort should be tied to std::vector.
 
@jalf A free function would be fine.
 
user1174868
11:28 PM
I made $6 on diablo 3, pretty good haul for the day
 
Ell
@deadmg then you would have to write another free function, making it pointless that the first one was free
 
@Ell Naw, because then you can trim(s) without having to know if s is a std::string or rope.
and in addition, if rope provides the necessary interface, you can write one function that can trim all ways of storing a range of Unicode codepoints.
 
@jalf Kind of. But I get DeadMG's point as well. It just seems Trim whitespace is a common operation done on strings.
 
@Ell What if we come up with 40 utility functions for a string? What if I want to pass a string as a parameter to a function defined in a widely included header? That header should include as little as possible to minimize compile times. If all those utility functions are members of std::string, I'm out of luck, I have to include it all or nothing.
If they're free functions, they could be located in something like <stringutil>, and I could include the minimal string class only in the header
@JimNorton It absolutely is, and it should be available in the stdlib imo.
Just not as a member function :)
 
Ell
@deadmg if it was a template I could see, if it just accepted std::string i couldnt
 
11:31 PM
@Ell But trimming can be a template.
no reason why you can't trim a rope, or deque<char> or whatever else I can come up with that offers the necessary iterator characteristics
 
Ell
yeah I know for some reason I assumed non template
does wide have templates?
also, what is a rope?
 
@Eli if you ask people involved with the C++ standards committee, a more common complaint about std::string is that it's too big. It has too many member functions, not too few. :)
 
Okay, this beer tastes great.
 
@Ell Roughly.
 
Most of what it does should have been free functions
 
11:33 PM
@Ell Uh, it's kinda a hybrid between a deque<char> and vector<char>.
it offers things like log(N) substring complexity
 
Ell
ah kk
@jalf really? like what? I can only think of .length :P and that needs to be a member
 
@Ell size()?
std::string has 99999 overloads which could be free functions, or just don't need to exist at all.
 
@Ell All those half-dozen different flavors of find, for example
 
it's because it's a bastardized container from before the STL was integrated.
and then it became a proper container.
 
Ell
so is an appropriate rule if it is implementation defined then put it as a.member but if it is for a widely used interface then a free function?
 
11:35 PM
so it has the full monty of everything.
 
Ell
Erm yeah that's what I meant
 
@Ell Check the link to Herb Sutters blog I posted above
 
@Ell If it does not depend on the implementation, but only the interface, then it should be a free function.
 
It describes what the appropriate rule is
 
Ell
I'm on my phone ATM but I will check tomorrow after the cinema :)
 
11:37 PM
@Ell As a rule of thumb, if the function can be implemented in terms of the existing public member functions, then it might as well be a free function
that way you minimize how much code has access to the private members, and so it becomes much easier to enforce invariants
it's better encapsulation, basically
 
Ell
is there a guisline that says publicbl functions shouldn't be virtual? or is that something I have imagined?
 
and much of the string cruft can be implemented just by using begin() and end(), really
@Ell There is, but that one's never caught on quite so much, I think
Not sure I'd call it a general guideline. More of a useful design pattern, perhaps?
 
Ell
ahh okay
 
something that's useful to keep in mind, and use where applicable
 
I've read a lot about that idiom, but I've very rarely actually seen it used.
 
11:39 PM
but not something that you need to always do
 
they mostly apply when you have multiple base class virtual functions that interact with each other
 
Ell
iterators ehh. don't know what to make of them. to me they just look like pointless pointers when a for each method would seem easiser
 
Ell
Ohh okay
 
@Ell But what if you don't need a foreach method?
 
11:40 PM
@Ell Iterators can operate on any container.
you can std::sort a circular_buffer, if it offers RA iterators.
 
What if you need to find the first element for which some criteria holds true? foreach can't do that, but an algorithm applied to an iterator pair can
sorting can be done with iterators, it can't be done with a simple foreach
 
you can use std::copy with a back_inserter.
 
Foreach is great if you want to run through the entire container, starting from the first element, and going to the last element. Iterators provide a mechanism for iterating, but doesn't force the policy of where you start or end, or in which direction you move
<algorithm> is basically the reason why iterators are useful :)
 
fuck, Steam sale
 
Ell
I guess I havebt needed the complex algorithms enough
or even the simple algorithms
 
11:49 PM
y u make deals that last like 8 hours?
 
user1174868
no good games on the steam sale
 
WTF am I gonna do when, y'know, sleeping?
 
Ell
:L
sleep?
 
something I'm gonna do soon
 
Ell
generally one does the activity being done while doing said activity
 
user1174868
11:50 PM
I fucking hate the number 6
 
oh, jalf
 
Well, my ass just fell off, for Yahtzee has recommended Spec Ops: The Line.
 
remember you said that my university might just suck at CS?
@EtiennedeMartel I know. He actually recommended a game. He must be sick or something.
 
@DeadMG Well, he does recommend games from time to time. And I tend to agree with him most of the time. Like for Bastion. Or Portal.
 
I still have access to all my examination material from the summer, and you could view it
@EtiennedeMartel Eh. I actually couldn't really get into Bastion. It didn't seem to actually have much to it.
 
11:53 PM
Well, it had tight controls and an engaging story.
 
the gameplay was "Make character dance in circle to dodge projectile or melee enemies, or at worst, flat out kite them. Then use ranged weapon to defeat them. Take health pot occasionally."
 
I don't know, I liked it. It felt frantic.
Especially with the shrines and stuff.
 
it's like an RPG but with the "RPG" elements being "Choose one of two ranged weapons"
 
Anyway, I'm weird when it comes to games. I mean, I'm starting to consider the best game I ever played to be EarthBound, and that game had shit gameplay.
 
Ell
@deadmg ooh if there was an archive containing all past papers and notes and whatever it would be helpful :L
or is there not one? or is that nit legal?
 
11:56 PM
Maybe it's because for me, games are primarily a form of artistic expression, and any game that makes me feel something is automatically good in my book.
 
@EtiennedeMartel I like a good story. But I spend 90% of the time in a game playing the game.
ignoring repetitive gameplay for a good story is blowing 90% of my time investment right there and then.
 
Ell
my fave game is trade empires which nobody has heard of. you can't even pirate it.
 
My top 5 of games would probably be EarthBound, Majora's Mask, Metroid Prime, StarCraft and Super Mario RPG.
So that says a lot about my tastes.
 
hmm
 
Actually, scratch that, I preferred Diablo 2 to StarCraft.
 
11:57 PM
IMO System Shock 2 is the best game of all time.
but picking the other four would be more difficult.
 
user1174868
I didn't like System Shock 2
 
I don't know, most critics think it's Ocarina of Time.
I never played SS2 though.
 
user1174868
Half-Life 2 is probably still my favorite game, but I have bad memory so I want to say Bastion is now my favorite
 
I played Bioshock and I thought it was cool. But it was back when FPS RPGs were RPGs first and FPS second.
 
user1174868
they still are :P
 
11:59 PM
@EtiennedeMartel What, BioShock?
 
@DeadMG No, SS.
 
yeah
 
Same thing as with Deus Ex.
 
the original System Shock was a bit of a bastard child
 
user1174868
I mean I ahven't seen an RPG/FPS with good FPS mechanics yet unless it is really just an FPS with levelling up and a shit story
 
11:59 PM
came out at about the same time as Doom (or slightly later) and a complex RPG interface was not well supported by the UIs of the time.
but System Shock 2 really hit the sweet spot
 

« first day (635 days earlier)      last day (4314 days later) »