« first day (1174 days earlier)      last day (3999 days later) » 

04:09
std::string is insufficient. I wrote my own instead. Hence the need for low-level string functions. — Sod Almighty 13 mins ago
@ThePhD "keyword*"?
@VaughanHilts You didn't link in the file that defines GameplayScene::didSwipe.
@LightnessRacesinOrbit kill it with fire
user3010322
@LightnessRacesinOrbit Yeah, sorry. I derped.
@LightnessRacesinOrbit It's defined in the header, so that should be okay?
@VaughanHilts Is it defined? Or just declared?
129
Q: What is an undefined reference/unresolved external symbol error and how do I fix it?

Luchian GrigoreWhat are undefined reference/unresolved external symbol errors? What are common causes and how to fix them? Feel free to edit/add your own.

CPP

`void didSwipe(CCObject * obj)
{
//CCSwipe * swipe = (CCSwipe*)obj;
exit(0);
}`
H

void didSwipe(CCObject * obj);
I don't see why I'd be wrong?
04:12
You didn't link in the file with the definition.
Very simple.
#include "GameplayScene.h"
So that makes no sense D:
@VaughanHilts Huh?
I'm talking about linking. Not including headers.
Follow the link to the question I posted.
Your C++ book should cover headers vs source files in one of the earliest chapters.
I think I see.
I dragged them out of an archive.
Having the same name isn't good enough though?
Do they actually have to be physically \linked\?
user3010322
@StackedCrooked That was a good talk. :D
pointers and C style casts?
04:21
@Rapptz Some silly library documentation I was given insisted this is how it's done.
I still have my doubts.
righto.
@VaughanHilts No
@VaughanHilts Yes
At compilation you include the header to get the header's contents into that file (usually function and type declarations), then you link in the definitions from another .o, or a .a, or wherever they are.
In short, #include "a.h" doesn't lead to your linker automatically linking the result of compiling a.cpp.
Ahhh, bloody hell.
-1
Q: C++ working with arrays

user3089755I'm trying to create a program that will store and log students grades. I need so help with a better way of doing this. It looks like a have the correct information...but my implementation is definitely wrong. this will be for 100+ students Thank you #include <iostream> #include <map> #include <

facepalm
He knows he's wrong, at least.
04:27
Yeah it's pretty bad
20
A: Produce the number 2014 without any numbers in your source code

dansalmoPython print sum(ord(c) for c in 'Happy new year to you!')

dang, that's good.
Such a not constructive question. That Julien, how dare he write this.
@Rapptz No numbers in the source code is technically hard to achieve :)
0
A: C++ working with arrays

Nisarg DesaiWell u can just declare array outside the array but not initialize and i think you shoud use mutidimension array in this case String students[100]; String grades[100][5]; void init() { students[100]={"st1","st2","st3"..........."st100"}; grades[100][5]={{"grade1 for st1","grade2 for st1","grade3...

@Rapptz What's the way to cast without C-style casts?
static_cast<T>, reinterpret_cast<T>, dynamic_cast<T>
have you read a C++ book? I feel like this would have been covered
04:36
I read some introduction pages and they actually told me to use a C-Style cast. :)
get a good book
C++ Primer 5th ed is pretty good (not C++ Primer Plus)
All the information on the web is all out of date and muddled.
Such a pain. :(
You won't find good resources for learning C++ online.
^ that
well, if you're pretty advanced, then there are some talks that will help you, actually
Seems that way.
04:37
They exist. But he won't find them.
First few hits just indicate the usage of C-style casts, so I went with those.
And the example pages I found.
C style casts are special kind of evil
they're willing to do even const cast in addition to reinterpret cast
jolly good times
iTunes music library is stored as XML, but it basically emulates JSON. Example
hah!
it seems to rely on fixed sibling node order?
totally non-semantic
yuck
@LightnessRacesinOrbit I don't think so.
I think the file is just read in memory.
And the datastructures take over.
04:41
Probably just straight up deserialized, yeah
I've been thinking about this. What would be the best way to store such information? (XML, JSON, relational db, plain text config files?)
@StackedCrooked Look at it
user3010322
Directly serialized binary blob.
Some of the nodes have "key, int, key, string, key, int" etc as siblings
every other node is presumably supposed to be the value that maps to the key node preceding it
Yeah, it emulates JSON.
04:42
but it's so flat
@LightnessRacesinOrbit Oh, I see what you mean now.
it shits on JSON's face
I don't get the "Smart Info" and "Smart Criteria" keys.
They contain mostly As.
@LightnessRacesinOrbit I just noticed it doesn't have an xml tag.
It's plist.
This allows them to say: we aren't breaking xml rules, because it isn't xml :P
@StackedCrooked ass*
@StackedCrooked It does. Chrome doesn't show it in the human-readable viewer but it's in the source.
DOCTYPE plist, but <?xml. Also .xml
05:01
HAPPY STACK OVERFLOW BIRTHDAY TOMALAK
It's so meta, it needs the meta-tag
user3010322
Happy Birthday, Tomalak!
user3010322
Tomalak is born on Jan 2nd? lol
> The NSA reportedly said in the documents that it had improved its oversight of Skype so much that it could now collect three times as many calls from the service than before.
Utterly meaningless statistic
@ThePhD Thanks :D \o/
user3010322
Well, if the NSA didn't report how many calls it was intercepting to begin with...
user3010322
05:06
We could never really quantify that.
user3010322
IIRC, Skype was never very secure to begin with. Swedish police had tapped it before easily.
@StackedCrooked JsonCpp is a good model
I've used JsonCpp in 2008 a lot.
I kinda liked it.
It's part of one of my libraries I use a lot
Lots of experience with it
I like it
Could use a new maintainer, though, it looks like
05:12
However, I don't writing code to serialize C++ structures to JSON and back. That seems like a job for compiler or tool.
Serialisation is notoriously hard to generalise
I suppose.
If you replaced all classes with tuples then it's possible :)
yep
tuples of boost::variant
and lots of inefficient cycling through types :P
user3010322
Hm.
user3010322
I seem to have backed myself up into typedef hell.
05:14
At work I was tasked to design a new rpc system for the communication between our client/server systems. I used tuple-based generic serialization (with protobuf at the bottom).
That's fun project :)
user3010322
I wish tuples and iterating over types at compile time was a thing. =[
protobuf also allows a recursive variant type. it's less space efficient than manually writing protobuf structures. however, using the recursive variant type, I can automate the message generation at compile time.
user3010322
Would make serialization much, much easier.
Only certain kinds.
Code generators are still the bestest. Well, and handwritten stuff too :S
user3010322
Yeah, but having a "good enough" default wouldn't hurt either.
05:18
I only need to support serialize(int), serialize(string), serialize(double), serialize(vector<T>), serialize(map<T, U>), and serialize(tuple<T...>);
the last one uses vector internally
map is implemented as vector<pair<T, U>>
user3010322
Could be more pack-friendly to implement it as vector<T>, vector<U> with a single size variable?
The system requires however, that the same headers are used by client and server.
So that the deserializer knows what type to expect.
@ThePhD huh?
user3010322
Nevermind me~
hm, it would be more pack-friendly to implement vector<tuple<T, U>> as tuple<vector<T>, vector<U>>
it would be possible to do this secretly inside the rpc lib
I've thought about that, but I feared I was having too much fun.
user3010322
As long as it works.
05:23
Currently it works, just not very space efficient.
At the protobuf level.
user3010322
Hm.
user3010322
I'm trying to come up with a sensible default for a lot of these things.
which things?
user3010322
Previously, things like Rectangle, Span, and Box all defaulted to TRectangle<int>, TSpan<int>, TBox<int>, but now I'm not so sure about that.
user3010322
A lot of their uses are for the unsigned versions, not for the signed versions.
user3010322
05:30
Ah, what the hell. I'll leave it signed: that's more useful for the general case.
@LightnessRacesinOrbit Like I said in chat an hour ago ^^ hahahahah
user3010322
But for the API, I'll take specific unsigned variants (like Spanu32)
You shouldn't be using unsigned numbers in non-bitmasks anyway.
Andrei would disagree :P
user3010322
The underlying API is unsigned (UINTs and all), for both GL and D3D. All the byte offsets and sizes are also unsigned.
user3010322
05:31
Still, Who really needs to use the whole range of an uint32 versus an int32 ?
Leaking details is not a reason :P
user3010322
I mean, 0x7FFFFFFF is a pretty huge range.
user3010322
Still, it doesn't help when all the goddamn warnings about signed/unsigned comparisons. >_<
@ScarletAmaranth Bjarne would agree. Herb too. I win.
uint16_t is handy for storing IPv4 Total Length field. uint32_t is handy for storing TCP sequence numbers :)
I think TCP sequence numbers are the ultimate use case for uint32_t.
You need the extra bit, and you need the wrap-around logic.
user3010322
05:34
A lot of my APIs used to just take lword (or std::ptrdiff_t) as the universal unit of measurement. But I kept being bit by the fact that things like std:: containers and all mostly use unsigned means of progress.
@ThePhD Yeah, that's horribly annoying :(
It would be nice if std showed a good example.
0
A: Error: No Match Function to Call

Narendra DubeyTry including algorithm header. I think then It should Work.

We'll need to start using Int. A UDT that does the right thing when compared against unsigned types.
user3010322
Since then, I've steadily been converting everything to std::size_t (or ulword), but... every so often, the case of "this really could be negative".
05:36
std::size_t is also annoying to type repeatedly.
You should have gone the other direction :S
user3010322
When I went the other direction, I had to do all kinds of casts, And every so often, negative casts would slap me in the face.
user3010322
This was especially apparent when I was working with streams.
user3010322
Dat ultra-positive seek. u.u
What do you mean negative casts?
05:37
I suppose explicit narrowing conversion, or something .
user3010322
static_cast to an unsigned or using unary - on a unsigned type, yielding bizarre results when chained.
user3010322
static_cast<std::size_t>( -1 ) cases, basically.
That's not going the other direction. It's a mix.
user3010322
Well, yes. I had to mix the two because the underlying implementation used std:: stuff.
You could cast in the other direction.
user3010322
05:39
But if I just go the "Lalalala everything is unsigned!" route, then there's no mixing.
More important: if there were negative numbers wreaking havoc... why were they were?
user3010322
@R.MartinhoFernandes True, but for (lword i = 0; i < static_cast<lword>( mvec.size() ); ++i ) got... well, annoying after a while. :c
Oh those loops. whistles.
user3010322
@R.MartinhoFernandes Because the APIs default was to take signed numbers, all the time! E.g. with Rectangle and Span being TRectangle<int> & related.
user3010322
@R.MartinhoFernandes Hey, hey, they're NECESSARY sometimes!
05:41
@ThePhD Yes, maybe. When you put them in a function for the algorithm you are writing.
user3010322
Yeah, but they're also useful for things like counting sections of a buffer that are changed and passing them to an underlying API, or when you're trying to iterate over multiple things with the same for loop.
@ThePhD Both signed and unsigned types accept negative numbers.
@ThePhD There are algorithms for the first. The second is an algorithm you write once and reuse many times.
fuck me it's almost 6am
user3010322
@LightnessRacesinOrbit Stay with us. <3
See also: Sean Parent's talk.
05:43
@ThePhD noper!
user3010322
Guess I'd better go google it...
user3010322
@LightnessRacesinOrbit :c Well, okay... have fun, wherever you go in Dreamland!
So I've calculated that if I repcap each day, plus a little over with accepts, I should hit 100k the night before I go back to work in a week and half's time :D
That'd be cute
@ThePhD What you need to understand there is that the negative numbers seem to be the problem (because in a situation where negative numbers are not a bug, unsigned is wrong in the interface)
I've recapped today (2nd Jan) already -.-
@ThePhD yay travelling :D
user3010322
05:46
@R.MartinhoFernandes Well, negative numbers are a bug for the underlying API. In fact, 90% of the API can't really handle negative numbers.
user3010322
The exception are streams ( seek( stream, -20 ) ), and... a few other things.
user3010322
Most other APIs are unsigned rather than signed.
@ThePhD But why do they cause you problems? Why is your code passing them in? Note that using unsigned will keep the negative numbers around, only disguided as four trillions.
-65534% of the API can't handle negative numbers
user3010322
@R.MartinhoFernandes Well, you can easily discard the "four trilliions" bug with a max-size check (400000000000 is not less than 44, or something). The problem, I guess, was passing the numbers straight to the API without doing negative bounds checks on the <int> based stuff.
05:49
Yes, that's exactly what I meant.
user3010322
If I just change it to unsigned, though, I won't have to do negative checks: just positive checks for if the value is bigger than the max.
That is gambling.
user3010322
Is it?
How do you know for sure any random result was not originally negative?
user3010322
I don't.
05:53
See how it is gambling, then?
uhh...crap. how do I copy a virtual thing? :E
user3010322
Yes, if someone passes -1 and for a certain system that's not two's-compliment it flows into 1 instead of 4 trillion, I can't defend against that.
Oh well.
That's not what I meant.
user3010322
An API that takes signedness can better guard against "-1" and friends, if they're truly not allowed, but.
And two's-complement is not relevant.
The behaviour is well-defined regardless.
The standard defines it properly, not in terms of underlying representations.
user3010322
05:55
@melak47 What do you mean?
I have a base class with some virtuals, and a couple deriving classes
and I need to copy a whatever pointed to by a base*
but I can't have a virtual copy ctor, so how can I copy it :E
@ScarletAmaranth that's where I ended up, too
don't go killing me for "new" here, it's just an example: Base* cloneDerived() { return new Derived(*this); }
lol I won a Magic game with -15 :v
06:06
Bug or Platinum Angel?
user3010322
I won with -55 but that was only against Chandra. <.>
lol
Oh wait, you mean your opponent at -15?
Meh.
yeah
@R.MartinhoFernandes Platinum Angel is cool though
@ScarletAmaranth what I'm looking at solves the raw new by returning std::make_unique<Derived>(*this) :)
06:08
@melak47 obviously
well, std::make_unique does not yet exist technically :P
it does in VS :p
you're living in the past!
I have the november 2013 ctp, no worries
already polymorphic-lambdaing everything
@ScarletAmaranth make_unique was included with 2013 RTM IIRC
rly? neat
@Rapptz I once built a deck around it + gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=74644. Can't believe how bored we were that I played (on the computer) against my flatmate until the end, me at -2000+, him at +2000+.
06:10
:v
Can't remember the name of the other card, but I managed to put divinity counters in That Which Was Taken too.
what's Singleton 100?
100 single card decks?
A 100-card deck with no multiples other than basic land.
ah figured
sounds long
It's a weird format.
06:13
gatherer.wizards.com/Pages/Card/… I found this card on 4chan
someone asked "Which card would Hitler like to play with?"
heheh
It's supposed to be the same guy, but the black version doesn't have Crovax in the name for some reason.
@R.MartinhoFernandes I don't play magic! I've played other TCGs though.
So this is me learning.
Oh, it's in flavour text.
06:16
I'm also making a TCG (or well, trying to) and I want to get some UX design ideas and general game design ideas.
@Rapptz Ah, k. Well, with Overrun around it's not hard to swing for hundreds of damage at once, so -15 is not so impressive.
I just thought it was funny because I'm pretty nub.
Overrun is quite painful to be hit with.
Oh.
That's the card I used.
user3010322
06:19
Overrun, weee~
@ThePhD You know, that's kind of interesting. Doing (unsigned)x >= my_max is probably not that bad for error checking if it meets a certain maximum assuming you don't want any negative numbers.
afaik it's not UB since it's specified for unsigned numbers how overflow would be right?
though I can't think of a use case off the top of my head
Is there anyone who worked on Mysqlworkbench
is that a secret gym for people who use MySQL?
Yummm, honey sandwich.
06:33
@Rapptz no, but Cat++ will try to chase them away, so they will get a good workout >_<
Guy with two penes/penises (NSFW.. obviously... who is at work anyway)
user3010322
@melak47 So with a bit more magic, I got the direct RenderImage call to work pretty neatly.
@ThePhD should I be scared of this ~magic~
Yes
user3010322
You pass it an Image2D and it can render that directly. The good point is that Image2D is a RAM-based buffer, not a GPU-based one like Texture2D
user3010322
06:44
So now I can begin work on my raytracer no problem! :D
Sounds like every library I've used
user3010322
@melak47 Nah, it's just basic shader quad shit.
user3010322
I need to rewrite QuadBatch, though. =[
@ThePhD so how is it magic :p
user3010322
06:45
@melak47 By doing ♬magic♪ with textures
user3010322
Currently, it's taking the longest path down the code.
user3010322
It's got a bit of a bug, though, that would probably be better solved in another spot...
user3010322
Looks like fun.
Probably my worst hack ever. (Good thing it's just toy code.)
07:30
Bought myself a raspberry pi model b, I've been wanting to get one for so long but they were always sold out :D
user1804599
@Rapptz Two chicks at the same time.
07:59
@StackedCrooked Why?
lemme try
I also have 3.0.0
but I'm not on Mac.
It's probably the funky syntax. I could easily fix that.
Anyway. The crash occurs in libCPlusPlus.1.0.0.dylib.
lol it crashes for me too
> CPlusPlus::ClassOrNamespace::lookupType_helper(CPlusPlus::Name const*, QSet<CPlusPlus::ClassOrNamespace*>*, bool, CPlusPlus::ClassOrNamespace*) + 42
@Rapptz :)
08:02
Post a bug report
Dammit, I just opened the file to have a look at the syntax and it crashed again.
if you remove the entire static struct it doesn't crash anymore
however
isn't QObject a macro?
Oh.. it isn't.
class Q_CORE_EXPORT QObject
08:05
I got the minimal repro for crashing
the static struct by itself doesn't cause the crash (or the instance)
JBL
JBL
> TODO: UNDERSTAND INSTEAD OF HACK
Huhuhu
it's when you do QObject::event(...) that it explodes
That makes sense then.
It crashes at CPlusPlus::ClassOrNamespace::lookupType_helper
Which is called by CPlusPlus::ClassOrNamespace::lookupType
And QObject::xxx seems to involve lookup.
That code looks pretty bad.
urgh, have a bool and a std::string and const char* overload...and passing a string literal selects the bool overload. :c
user3010322
@melak47 Buahahaha.
08:10
Looks okay
@ThePhD how do I make it stahp :(
not too great but not horrible
I thought having a const char* overload would capture the string instead of it converting to bool :/
user3010322
@melak47 template <std::size_t n> void arf ( const char(& arf)[n] ); or whatever the stupid syntax is.
alias<const char[N]>& arf
08:12
void lookup_helper(const Name *name, ClassOrNamespace *binding, QList<LookupItem> *result, QSet<ClassOrNamespace *> *processed, const TemplateNameId *templateId)
// ^ 5 arguments, 5 pointers
That's just begging for nullptr derefs.
some just look like a replacement for nullable<T>
        if (Scope *scope = s->asScope()) {
            if (Class *klass = scope->asClass()) {
                if (const Identifier *id = klass->identifier()) {
in which case: get nullable<T>
I suspect that in many cases they could return T& instead of T*.
However, Qt seems to hold this convention to always return pointers.
Qt Creator doesn't have the excuse of being pre-standard C++ :P
08:15
Right.
@Rapptz alias<>??
template <typename T> using alias = T; or what's that?
I don't get it. I would think Qt programmers are above average. And yet they go against all standard advice.
user1804599
Can I use ::operator new(sizeof(T)) followed by placement new for any T?
@StackedCrooked why would you think that o_O?
08:17
@ScarletAmaranth Because my Qt Creator crashes everytime I open the file PostToMain.cpp.
@StackedCrooked oh, yeah, I mean, why would you think that QT programmers are above average?
@Rapptz woot, it works! what would be the unaliased syntax for that? (where'd the & go?)
const T (&x)[N]
user3010322
That's the syntax I gave you. =[
user3010322
y u no trust me u.u
08:19
alias is cooler
:v
user1804599
Use alias, unreadable code writer.
user3010322
q.q I is shame 2 famiry
tbh, alias is pretty useless but it's pretty neat.
Makes the C syntax bearable and more readable.
totally readable. I'd like a reference to an alias to a type please :p
user1804599
I like (*operator double() const)(std::string const&) { … }. :)
user1804599
08:20
I wonder where to put the explicit keyword.
@ScarletAmaranth Because of err. Quality Time?
heh
damn that was lame
@ScarletAmaranth because Qt isn't that bad? It's actually a pretty above average API.
@StackedCrooked My Qt Creator can't open anymore :/
shit
I see I see, I wouldn't know, I don't use QT
lol
@Rapptz lol
Delete the file?
user1804599
08:22
Use Vim.
user1804599
With clang-format on save.
I was trying to find a work around
got a work around for you
@StackedCrooked if you give the anonymous struct a name, it won't crash
-1
Q: Cut-Paste algorithm used in text editors

kamalbangaLet's say one wants to cut b from the string ab and paste it before a to make it ba. Then the most elegant in-place and also the classic algorithm is to 1) Reverse a 2) Reverse b 3) Reverse the whole string Is this the algorithm used in text editors for Cut-Paste and Copy-Paste.

Who said there's no such thing as a stupid question?
So I have to make my code less epic?
:P
Ok, done. It works! :)
Awww yes
new season of top gear on netflix
08:36
@harold you must be new here
@ScarletAmaranth very new
09:31
Is it bad when, sometimes, when reading back your own answer, you suddenly realize how freakishly elegant this must have looked to the uninitiated? stackoverflow.com/a/20448756/85371
Happens only when I'm tired. I guess it has to do with me not "seeing behind the curtain", and realizing the "magic level" of some of the boost libraries again.
@rightfold Reminds me. I should still see whether it suits me. Is confugaring it humanly viable?
TCGs suck
:)
09:50
Yay. You've found something in life to give meaning to!
Cranky bear tonight this morning?
(i just realized its 5am)

« first day (1174 days earlier)      last day (3999 days later) »