« first day (806 days earlier)      last day (4140 days later) » 

2:00 PM
I did go off and do the required funcitonality that was asked for
I submited the work, and the guy went nutters.
Eg.. They see our work via the svn shared repository
He didnt like the solution, and this resulted in most of the code base to be pulled down because he didnt want it to be used with his engine.
Thats when he went away and created this huge monolithic api
 
irrelevant.
if you don't like them, find someone else, or use a contract to force them to behave how you like.
 
Well im not the boss
I have no say over the contract with him or the bussiness I work for.
I did make the report regarding it, and was told to work with his new provided api.
 
0
A: Should std::list be deprecated?

dusko2sciccaWhen comes to doubts to use list or array there is one big book that provides the best answers to it all. Bed thing of that all is also the problem of some older things, but if the lists are so bad Way do they even exists. Some things that bother me when it comes to speed the things are not so ba...

WTF is this?
 
@FredOverflow lawl, indeed
 
This is not complex stuff, even key bindings or mouse input he wanted to create a solution for us through his api.
 
2:05 PM
@FredOverflow really bad english
 
@johnathon that too :)
@johnathon btw, hey again :)
 
@Tuntuni Good morning :)
 
@Chad Then that's it, it's over. Have fun with his API.
 
@johnathon morning? :o it's 15:06 here ;) where do you live?
 
@Tuntuni in the united states, it's 8 am here
 
2:07 PM
@johnathon ah :) good morning then
 
@DeadMG I know, though its a bit of a rant because seriously to write it directly is 10 lines of code. Their system its auto generated code, to some interface. Its one hell of a nightmare lol
 
which company is this?
 
not a normal one lol
no SLA, or defined roles
Actually two guys wanting to make the next 'big' thing
 
not the question I asked :P
 
Wanted to share the story around the water cooler. Hear other crazy projects other have had to work with
 
2:11 PM
eh
the craziest shit you'll ever find is in university
 
sehe, Netherlands
65.5k 5 48 103
Ow. 2^16 reputation :)
 
@sehe Nyaha.
 
@sehe One could say you've got SHORT reputation. lel :D
 
@DeadMG Better?
 
but it's 65546 now.
 
2:14 PM
@Tuntuni Implementation defined. I think shorts are usually 32 bits
 
It looks like the bear is ashamed
 
@sehe Nah, 16, I think.
 
@sehe true ^^ it is 16 on windows though
 
@DeadMG Great.... Glad I scrotted it before :)
 
lol
 
2:16 PM
Well word, and dword used to be used to denote the size of the reigster on the cpu. I dont think its used anymore
 
it isn't
or rather
depends on your specific use
 
your very active today @DeadMG
 
the term "word" still has that meaning
I am?
 
yeah
Have a king charles back home
 
how so?
ah :P
nice
 
2:17 PM
Its he a pure breed?
 
but I'm afraid that this particular puppy is, well, very active.
 
Seems like hes a cross
 
@Chad i think they are. there are still typedefs in the win32 api.
 
no, she is quite pure breed, I'm fairly sure.
 
Genesis 1:1 In the beginning was the word. And it had two bytes.
 
2:18 PM
lol
 
@Tuntuni The WinAPI varieties are fixed.
 
lol
lets all use hungarian notation
 
@Chad not if we can avoid it
 
@DeadMG fixed? what do you mean?
 
@Tuntuni They do not vary with CPU address size.
 
2:19 PM
Though nothing wrong with hungarian notation people just got it mixed up mean to denote the type in the name though its true purpose was to denote its useage.
 
range-based for: auto, const auto, const auto& or auto&?
 
@DeadMG oh, i meant fixed as in patched. :) true
 
@Chad No, that's still quite wrong.
 
Our one is like that, they're adorable when they're small
 
the usage of a variable is in the type.
 
2:20 PM
it seems it always picks the const_iterator.
 
if you need Hungarian Notation, use a better type system.
@rubenvb auto&& usually.
 
no const?
 
why would I want it?
 
no idea.
 
I am iterating over the content of the container, and if those contents are not const, why add it?
auto&& is one of my favourite things.
 
2:21 PM
the contents are supposed to be const anyways.
 
then why does it surprise you that it would pick const_iterator?
 
actually hungarian notion is used as follows int intAccountNum though the true purpose of it was to denote the usage of the variable such as int accountNumber
 
I always though auto&& in a for loop degraded to being the same as auto& anyway.
 
if the container is const it sure can't use iterator.
@rubenvb Nope, perfect forwarding.
 
@DeadMG right. Mindfart.
Next on the todo-list: convert all for and for_each to range-based for.
oh joy.
 
2:22 PM
@Chad The first is definitely just wrong, and for the second, if it's not obvious enough, then use the type system.
@rubenvb Not always possible.
btw, did anybody ever finish converting Ogonek to build with MSVC?
 
@DeadMG haha lol
 
yeah
 
The Robot's code is too kewl too work on MSVC.
 
funny, I know
@Chad I've read it, and he's what's wrong.
or rather, he is correct in that type-based Hungarians sucks.
 
2:23 PM
@DeadMG Most of them are dead-normal take something from each item.
 
@DeadMG listening
 
his example of encoded strings is a perfect example is where the type system should be used instead.
given the correct interface, you could use an Unencoded and normal String perfectly interchangably- no need for Encode calls everywhere
which makes it not only far simpler, because you're not manually dealing with calling Encode every three seconds, but the compiler proves safety at compile-time.
 
I think he actually goes on to say to use the type system to do the conversion for you
 
I have read the article a couple times and did not see any such, and I don't see any such now.
 
@DeadMG Was intrested to see what your view point was about hungarian notiation. Though most collegues when i discuss it normally have no idea.
 
2:26 PM
of course, I think he's had a billion emails describing how incorrect he is on some of his points.
 
Once I showed my code using hungarian notation. I got scolded, changed all of it, and was very happy afterwards.
 
@DeadMG What's Ogonek?
 
ultimately, if you have a type-based system where not respecting the types is a serious or potentially serious cause for error, then use the compiler's type system to prove correctness.
 
I first had a half-assed hungarian thingie (p_ for pointers, m_ for members, nothing for local and function arguments).
 
that's the only sane way to go
@yetihehe Robot's Unicode library.
 
2:27 PM
I got rid of that when I made all my data members public.
 
Ok
 
Now I'm very happy.
 
@rubenvb Eh, I'm not so against m_ for members.
that's more about resolving naming conflicts than actually indicating that it is a member.
 
@DeadMG I noticed it was there for no good reason. I resolve conflicts (mostly in class constructors with the full qualification in de declaration: ::libambrosia::typename)
 
Well to a point DeadMG there are situation like in C++ that the std can not be extended using inheritance. Though this can be using composition. Though generally in a situation like the std and novice programmers sometimes it is easier to use hungarian notation (correctly) when fundermentally you cannot inherit the base type to make it easier.
 
2:28 PM
makes the "user" code a lot more readable.
 
@rubenvb Me too.
 
eg... std::string
 
@Chad Why would you want to use inheritance?
inheritance is the worst tool for code re-use you can get.
 
Why would you even want to inherit from std::string?
 
Its a perfect example where you can use inheritance to do the conversion to a base type
 
2:29 PM
but you don't want to do the conversion through inheritance.
 
eg... add your own methods, or features
 
because you need to call Encode between UnencodedString and String.
 
well, lets say you have
class EncodedString : publice std::string

Then you can use the inheritance to do the conversion from the derviced type to the base type. Eg.. taking that std::string is unencoded string.
how would you do it?
Granted my example probably is wrong (dont need to point that out) How would you do the conversion using the type system from a encodedstring and a unencoded string? using the type system?
 
ah
no, that's just miscommunication
you have that the "special" extra class is encoded.
 
@Chad some class with a std::vector<char> and a decent interface that takes care of the conversions where necessary.
 
2:33 PM
it's the other way around- the "special" extra class is unencoded.
 
You can define any conversion operators you want and have the conversions be handled automagically.
 
else, it would be impossible to output an unencoded string.
 
@DeadMG agreed. Though granted with the std::string it was never designed to be inherited. So you have to favour composition over inheritance.
 
@Chad As should be done.
there's no reason to use inheritance in this case.
or rather, what would be more effective is private inheritance.
then nobody can perform an unsafe conversion.
hmm.
actually, that might be the bads, because it would interfere with your conversions.
in any case, composition is the best way to go
 
:)
 
2:35 PM
you can use converting constructors/operators and be absolutely fine.
 
and don't use std::string as composition thingie unless you have a good reason.
 
well size of std::string is about 32 bytes last time i checked without anything in it
 
(thingie->composed class?)
 
@Chad SSO is nice, but 32 bytes is larger than usual for "small".
but then I guess that if you're on x64, three pointers is 24 bytes anyway.
 
16 or 32 i forgot. I think the former.
 
2:38 PM
16 bytes
that would be three x86 pointers, and one small segment of wasted memory for not having the correct zero-size allocator optimization.
no SSO employed
 
oh no it creates a small temp buffer for short strings
 
there's no space for the temp buffer.
16 bytes is all consumed by the regular data.
unless they only use a 4-character SSO and do use zero-size allocator optimization.
 
32bit not 64bits
 
@Chad I know. You need three pointers- 3x4bytes- for the regular heap-based data.
 
Well length is 4 bytes, and a pointer to the data is 4 bytes. So it should technically be 8 bytes instead of 16.
 
2:40 PM
@DeadMG You could use the wasted 4 bytes for SBO.
 
@Chad You need capacity.
also, it's more cleanly expressed as a pointer triple than pointer, length, capacity
oh fuckshitballs
I did not correctly specify my Unicode container to permit SSO.
 
union _Bxty
{ // storage for small buffer or pointer to larger one
_Elem _Buf[_BUF_SIZE];
_Elem *_Ptr;
char _Alias[_BUF_SIZE]; // to permit aliasing
} _Bx;
 
can I limit the range of a range-based for?
as in, 1 before the end?
cause that's a nullptr?
 
you'd have to use a range-based algorithm to perform such a task, like boost::range.
 
damn
 
2:45 PM
@DeadMG what is SSO?
 
Whoa.
They added a new type_index class to C++0x
I don't need to program a Type class anymore.
 
@Chad Short String Optimization.
 
Well, I do, for demangling, but still. Yay~
 
Anyway to remove the short string optimization from the std::string?
 
you don't want to do that
it's an optimization, it makes things go faster, it's not for fun
 
2:47 PM
I can see it in some situation being useful but if you wanted a tight string representation that sometimes have nothing in them butl NULL strings then 16 bytes do go to waste for holding a null
 
that's completely immaterial
I mean, "sometimes"?
 
We do have a string class that only requires 4 bytes.
 
@Chad are you working on like, embedded, or data sets that require server farms?
 
a string has to be able to deal with every case.
@Chad How does that possibly work?
 
Pointer to (shared) data probably.
 
2:49 PM
Fred got it
 
I think sizeof(std::string) == 4 holds in g++, or at least that used to be the case.
 
yeah
I think that it's illegal for std::string to have a COW-based implementation now.
 
The heap allocated struct holds the size, and then the character array that is null terminated.
 
ewwwww null termination
why would you do that to yourself
 
To make c_str constant time, probably?
 
2:50 PM
Because allmost all C/C++ require a null terminated string
 
right, but it can be added on demand fo rnothing
 
why make things complicated?
its only 1 extra byte
 
But then c_str wouldn't be const, right?
 
no, no
screwing around with NULL terminators is complicated.
if you use c_str on demand, then you don't have to screw around with them except in c_str.
 
in essence that is what C/C++ stdio api is all about
 
2:51 PM
@FredOverflow Nah.
@Chad And those APIs are absolutely terrible.
both of them should have been destroyed in the fires of hell before being Standardised
 
@DeadMG yes they're horrible and terrible but they get the job done they're pretty much universally understood.
 
@DeadMG But it must be const according to 21.4.7
 
@DeadMG backwards compatibility... in a small way chains us from marching forward
 
Its the lowest common demonitor with C/C++ strings
 
@FredOverflow Right, but you don't have to make it non-const.
 
2:53 PM
@FredOverflow mutable or const_cast.
 
@rubenvb Right.
 
it's the implementation. It can be ugly.
 
you're talking about the byte which is one past the end, so the user can never observe it.
 
I have never used mutable and always forget it even exists.
 
null terminated
 
2:53 PM
so when you change it, you're not violating any expectation of logical constness, because the NULL isn't part of the string's logical value.
 
@FredOverflow If often need it for mutex members. Or, better: if I use mutex members, they usually need to be mutable.
 
Would you stop pinging me already? ;)
 
@DeadMG I agree with you it would be more safer to not have a null terminated string. Though at the end of the day by not having it, is going to cause more problems than having it. Thus communicating with (crazy dev) api that is old school (in some way) and he uses all null terminated strings. Actually I havent come across one library that doesn't use null terminated strings.
 
@Chad Right, but what I'm saying is that you can have a NULL terminated string without actually having to deal with the NULL terminator by lazily inserting it only when it's needed.
 
oh roger
 
2:57 PM
it makes all the other operations simpler to not deal with the NULL terminator, except to have to allocate space for it.
 
@DeadMG I agree with you it does make operation simplier. Though the case would need to be that when communicating with other api or frameworks we would need to do conversion from the null terminated string to our string and back and forward.
 
which is just a +1 in your __allocate_more_space function.
 
@Chad That's very simple to do.
it's one extra line of code and one conversion function.
 
which would have to be there anyways if not inheriting.
 
got one question that has been nagging me that i think you guys know the answer.
 
3:06 PM
I know the answer to a great many questions.
 
lol
 
because it's funny
 
It was using a template funciton, and there was another template funciton with specialization that would return the user type.

template <class T>
void DoSomething(T &type)
{
enumType etypes = GetEnumType(type);

switch (etype)
{
case eInt: // Do something with the int
break;
case eDouble: // Do something with the double
break;
case efloat: // do something with the float
break;
}

}
 
This is the silliest thing I've seen in a while.
 
3:08 PM
agree
 
okay okay
 
how about overload or explicit specialization
 
and get rid of the enum.
 
This would make you laugh it was not to have to write the same code over and over again for the different speciailization types
 
unless you really really really need to have the explicit type for some arcane reason
 
3:09 PM
It was a serializer that would take any type, that would serialize its type out.
So the type, was serialized out with its enum valu.
 
@DeadMG Actually I was referring to the gif, but now that I look at the code above my comment I think it works really well there.
 
[id][data]
Though generally, I got bitten by the type system. Because the code for handling int was in the same as short there would be type conversion problems.
its not perfect, thats why i wanted to ask how best would you see doing the same thing but without getting into the type system complaining.
 
serialize(double x) { output << somedoubleidentityvalue << " " << x; };
you can even make all of them explicit if you want the implicit conversions to be impossible.
 
agreed that was my first attempted I wanted to keep the enum identifier and the type close together. Thats why I came up the enum fields. Didnt want to write a lot of speciailization functions over and over again.
 
but instead you wrote switches over and over again?
 
3:16 PM
No there was just one switch case
 
and use plain function overloads
 
ouch - I think I have to clone() a boost::variant<> type (that's recursively defined nonetheless) - this is not going to be fun
 
boost::variant<> x = src;?
 
@DeadMG as part of the variant it has boost::recursive_wrapper<> inside - I would be very happy if that worked...
...not sure how it can, though - will have to dig into the code a bit
 
bint
@kfmfe04 That's boost::variant's problem.
 
3:25 PM
whats wrong?
 
it's very bad form to just dump your problem in our laps.
 
don't dump code here.
 
this place is the chat
 
@DeadMG gonna take a break and then come back and try it - writing a test wouldn't take long (if boost::variant<> and boost::recursive_wrapper<> are smart enough, I will be very happy)...
 
especially not without saying hello first
 
3:25 PM
well, the chat expanded my gist snippet
 
it tends to do that.
 
@BeatMe try using [title] (url) and try again?
 
use ideone or SO proper
the latter is preferred.
 
SO proper?
 
3:27 PM
you mean I should ask the question on stackoverflow?
 
@BeatMe Yes. Kind of. Not that you can't ask questions here.
 
but?
 
Dec 23 at 1:02, by Cat Plus Plus
If you're new and don't want to be hated, read the rules.
 
@DeadMG that comma operator! <GASPS!>
 
3:31 PM
well yes, wasn't my intention to pop a whole snippet into the chat
 
@rubenvb That's a declaration?
 
and I wouldn't mind if I get no immediate answer, I know most of you don't care
 
Is there an automotive SE site?
 
@LuchianGrigore They're all pretty static.
 
but I had a simple question, had some code with it to illustrate my problem and thought I could ask here, as c++ tends to work more with bitwise operators than c#
 
3:32 PM
@DeadMG JSON :D
 
@BeatMe what are you trying to do, with bitwise operators, in C# ????
scratch that, what are you trying to do period?
 
@StackedCrooked Who pays for all the storage?
 
is there and c++ version of itoa or sprintf when using %x, %d, %o, etc.?
(converting numbers to strings that is)
 
@rubenvb all the advertisements on the side of the site
 
any*
 
3:34 PM
@rubenvb I don't know but I think you can find that information in the About/FAQ sections.
 
@Tuntuni std::to_string
you hopeless bunch didn't get my automotive storage pun
 
@rubenvb and if i need base 2?
 
@johnathon: its a poker hand evaluator and it works with an encoded 64bit variable that contains up to 7 cards like this
@johnathon and I want to extract the single cards again, but aren't used to bitwise operators
 
@Tuntuni then use a std::stringstream with <iomanip>
 
@rubenvb ah, kk, thanks
 
3:36 PM
@BeatMe are you trying to run this thing on like, 0oh i dunno, a server running a 486?
 
so I guess it might be possible to loop trough each bit and return a card if it's true
 
@Tuntuni or if you savor performance over readability, maintenance and error, use your favorite C crap ;)
 
Seriously, other than to attempt to save space...
Why are you trying to do this?
And .... vector<bool> would be your friend right about now...
 
because I don't need the complete hand but single cards again
 
Right. But why are you stuffing the complete hands into one 64 bit integer?
 
3:38 PM
@rubenvb heh well i'm doing project euler problems and need to have a str representation of the number in both base 10 and 2 and since i'm using C++ i'd preffer using C++ stuff over C calls
 
vector<bool> is only good when you want/need the extra storage space.
@Tuntuni I like you already. Optimization can happen later anyways :)
 
@Tuntuni you can use stringstream to do it, using ios
 
And stringstream is prettty performant anyways if used correctly. Or I am just lucky :)
 
@jonathan because apparently the evaluator can use different mask to get information about the ranks and suits faster than comparing every single card
 
@rubenvb haha thanks ;)
@johnathon ok :)
 
3:40 PM
but thats not exactly my design, but I need to work with it nonetheless
 
doesn't C# have a bitmask class?
Anyway, for masks, just use an integer or a std::bitset.
which is a great idea for my only bitmask I have.
 
ok.... I kinda need to understand the situation , your in need of writing a function that takes a 64 bit int , and spits out a hand of cards
 
exactly ;)
 
in poker...
whats the maximum number of cards a person can have in poker?
like, 7.. 8?
 
7
 
3:44 PM
yea
 
well, I know now that I could just loop trough every bit, and return a card if it's true
 
this 64 bit unsinged
 
but might there be a faster way?
uh i guess
 
why are you shuffling cards with bitwise ops?
std::shuffle
 
rubenvb... why he's using bitwise masks to represent a hand of cards i dont think is his doing.
 
3:46 PM
I'm not shuffling, thats something entirely different
 
do i use flush() on a stringstream to empty it?
 
@Tuntuni yes.
 
@Tuntuni no, you call std::stringstream::str with an empty string ""
 
@johnathon awesome. :) also, is a stringstream guaranteed to be empty when created or should i call flush() anyway?
 
Err...
 
3:48 PM
@rubenvb oh so ss.str()?
 
@Tuntuni ss.str("").
str() will return the internal buffer thingie.
 
flush
Flush output stream buffer (public member function)
 
the API is terrible.
 
ah str() is overloaded :)
get/set
right, thanks :D
 
yeah
 
3:49 PM
so, same question as before, is the ss guaranteed to be empty when created or should i call str("") for safety?
yup, empty :)
checked
 
yes
 
mmhum
 
this evaluator is called many million times, so every small bit counts. The fastest evaluators all use this format, as not all information is important. for example if you have 5 cards of the same suit, it's automatically a flush and we don't need to compare any ranks. If you're interested in this topic, this is a good starter.
 
Anyways, I don't think it's important for my question. Is there a better way instead of looping trough all the single bits?
 
3:51 PM
@rubenvb ya just checked there ;)
 
it's not perfect, but useful
 
There is. Think about how you've got the cards packed, and you'll see it
 
I think MarcB hasn't had sex in a very long time!!! — ricola86 17 secs ago
lawl
 
sorry, I don't get it ;)
 
well, isolate 8 bits at a time , for each suit, stick it in an int, and that int's value will determin the cards held... without having to look at individual bits.
 
3:53 PM
@LuchianGrigore lolol
 
err 16
smh
 
damn, setbase doesn't allow base 2 :(
 
ok
so I would need a lookup table, what number corresponds to which cards?
 
Yes, which is easily to construct. As you should know this , as your more famillar with the problem domain than i think you wish to let on.
bbl.
 
ok, thank you ;)
 

« first day (806 days earlier)      last day (4140 days later) »