« first day (703 days earlier)      last day (4260 days later) » 

7:00 PM
@JonathanSeng Neither of us knows what the teacher wants -- he might fail for using it, or just as easily (and much better) for failing to use it.
 
@TonyTheLion I was under the impression each C module would have it's own copy of ptr ( is this not case because they aren't static to the module )?
 
@R.MartinhoFernandes Across different TUs? Or do I not understand the situation?
 
storage class specifier <-- what exactly is that?
 
@LucDanton Oh.
 
@TonyTheLion extern or static, (and previously: auto)
 
7:00 PM
Lemme read again.
 
Is today Monday or Tuesday?
 
@MooingDuck oh I thought it was int etc too.
 
@MooingDuck Or typedef sows confusion
 
@CatPlusPlus Tues here
 
@CatPlusPlus latter.
 
Xeo
7:01 PM
Caturday
2
 
@CatPlusPlus Tuesday
@Xeo lol :)
 
thread_local up in this.
 
Xeo
Every day is Caturday after all.
 
@R.MartinhoFernandes damn you robot
Can't spell today, meh
 
@Chimera Ok, that does sound fishy.
@TonyTheLion What?
 
Xeo
7:01 PM
@TonyTheLion Wait, the duck is a robot too now? No wonder it can "moo"...
 
@Chimera You're getting confused between "declare" and "define". You should define in one file and declare in a header. C, however, has a concept of "tentative definition" that allows multiple definitions, as long as only one includes an initializer.
 
@R.MartinhoFernandes Yeah, that's what I thought.
 
Oh, right, the comics were yesterday.
Makes sense.
 
@Xeo my mistake :(
 
"C, however, has a concept of "tentative definition" that allows multiple definitions," <--- so this is the part I wasn't aware of because I never relied on it.
 
7:02 PM
How can I fill the timesheet for this month if I can't even tell in what part of said month we are.
 
@JerryCoffin ah so no initializer would mean it's tentative?
 
@JerryCoffin Thanks!
 
Blblblb.
 
@TonyTheLion For future reference, when I add "sows confusion", it means I'm being pedantically accurate, but it doesn't matter much, and it's probably better if you ignore it at least at the start.
 
@CatPlusPlus don't remind me of timesheets :(
@R.MartinhoFernandes ah I see.
 
7:04 PM
I'm 3 weeks behind on that, because I always forget.
 
What's a timesheet?
 
@CatPlusPlus I'm about the same behind. I just can't be fudged really.
 
@TonyTheLion Taste is not considering it food unless processed.
 
@R.MartinhoFernandes a sheet where you fill in how long you spent working on what, it's mostly electronic these days. Mostly used in companies in order to be able to accurately bill their clients
 
Xeo
7:05 PM
@R.MartinhoFernandes You have something against tomatoes?
 
tomato hater
 
@Xeo Against raw tomatoes, yes.
 
@R.MartinhoFernandes The thing you fill to make people who make money happen aware of how much money they need to make happen.
 
Xeo
:O
 
Tomatoes have that nasty habit of ruining my food.
 
7:06 PM
So I think "tentative definition" sucks because you'd never know about if you followed proper style... ie not define variables in header files, only declare them as extern.
 
Xeo
But but but they're tasty!
 
Tomatoes are good.
Maybe you're mistaking them with toes.
 
How do you have spaghetti bolognaise if you don't like tomatoes?
lol
 
@Chimera Yes, it definitely sucks. It encourages sloppiness.
@TonyTheLion They're not raw, are they?
 
@R.MartinhoFernandes You're a weird robot-person.
 
7:07 PM
@R.MartinhoFernandes So I will consider it a point of pride that I didn't know or need to know that "tentative definition" existed.
 
Yes, I admit I have some peculiar taste in food.
 
@R.MartinhoFernandes oh yea, details.
 
There's no burgers without tomatoes.
RAW
 
Xeo
@R.MartinhoFernandes But salad!
 
@CatPlusPlus Burgers are one of the foods they insist on ruining.
 
7:08 PM
lol
 
YOU HAVE NO SOUL
 
I also don't like the texture of strawberries so I don't eat raw strawberries, but I like strawberry flavoured products.
@Xeo You mean, that thing that is essentially a bunch of raw vegetables thrown together? No, thanks.
 
@CatPlusPlus Oh yes, raw tomatoes on burgers? Hmmmm.
 
I tried to give a chance to raw vegetables more than once. At all times it ended up with a plate full of salad straight to the garbage can.
 
Xeo
You totally haven't eaten the right salad.
 
7:10 PM
Yeah, right.
Does the right salad have tomatoes in it? If so, I won't like the right salad.
 
@TonyTheLion Basically, yeah -- then if it reaches the end of the TU without seeing an initializer, the tentative def becomes a real def (only it could also be a composite of the tentative definitions, so one might say volatile int x;, and another const int x;, so the composite becomes const volatile int x; (or something like that -- don't remember all the details).
 
And seriously, some people make salad out of raw vegetables and disgusting stuff like olive oil, or vinegar.
WTF is wrong with your taste buds?
AFk, dinner (no raw vegetables included)
 
Xeo
@R.MartinhoFernandes YUMMY
Just had that today!
 
I love greek salads.
 
@JerryCoffin ah ok
 
Xeo
7:14 PM
With tuna fish, mozzarella, grated cheese
 
You're making me hungry.
 
Xeo
And some meat
Was sooo yummy
I love salad.
 
Yeah, me too. There are so many things you can put in them.
 
You get 100 bonus reputation for having an additional stackExchange account? That's.... just free reputation....
 
@JonathanSeng I think you only get it on the new site.
 
7:16 PM
@DeadMG I added an account for meta and got 100 points in stack overflow.
 
meta's different
 
@DeadMG Well, of course it is... Oh. ;-D
 
@JonathanSeng Only if the other account as at leat 200.
 
@Drise Yep, because of tentative definitions. Now that I read up, I understand why..;. it;'s fucking stupid though.
 
@Chimera It's still problematic across several TUs.
 
7:18 PM
@LucDanton Well according to what I've read if you don't initialize the variable in a module it internally becomes external linkage.
 
@DeadMG 'thfuckisthis?
 
@DeadMG hes quite a bit bigger now
 
@Chimera The rules are almost terminally complex, because several compilers already did entirely different things before they wrote the C standard, and the rules are intended to accommodate essentially all of them.
 
@MooingDuck She, and is the same size as in practically every other picture I've posted. Just stretched out and uncut.
 
7:20 PM
@MooingDuck ...or that's taken from a lot closer.
 
@EtiennedeMartel Daisy, my puppy.
 
anyway, it's lame. You should be FORCED to define in only one module and EXPLICITLY extern in others.
 
@Chimera 'internally'? But nevermind that -- the crux is that a tentative definition is either a definition or a declaration with a later definition. But in either case there is still a definition. So if the tentative definition appears in several TUs, you have a problem.
 
@Chimera "codify existing practice" stopped them from doing that (in C). Of course, in C++ it's pretty much as you've asked.
 
@LucDanton That's what our code did at work, compiling with an older version of GCC and it worked... and I couldn't figure out why.
 
7:21 PM
Does it matter at all that it appears to work? What are you expecting?
 
@DeadMG The first pic I recall, her head was on your wrist and much smaller, in this pic she fills your whole lap. There's gotta be at least 5kg difference in them
 
@LucDanton It was working, I was expecting the damn linker to complain.
 
@MooingDuck That's not my lap.
oh, that picture is really old. She was much younger then.
 
@DeadMG picture is fuzzy
 
@Chimera You shouldn't. ODR violations are the kind of errors most likely to lead to subtle problems, without any diagnostic. Speaking as a practical matter.
 
7:23 PM
@MooingDuck Well, trust me, it's pretty clear that it's not my lap except I cropped out the rest of the non-dog picture.
 
okay, i'm back, anyways, as I was saying; i know I can do this:
oops
sorry
but you can read a 2D array from file like this right?
int foo[10][10];
file >> foo;
 
@LucDanton I told our team lead that code is unacceptable and had it changed.
 
@Link nope
 
@MooingDuck Puppy is fuzzy. Picture is blurry.
 
@Link no stream works with any container that I know of
@JerryCoffin pft. words.
 
7:25 PM
k
 
@Link you can write an overload if you'd like.
 
@Chimera Since differences between C and C++ came up, keep in mind that const int i = 0; at file scope in a header is a big no-no as well in C.
 
i might
 
obtw
 
@LucDanton I would never do that in a header file. Violates all that is holy!
 
7:26 PM
what do you guys think of replacing operator>> with a constructor from std::ostream?
 
@Link template<class T, int width, int height> std::istream& operator>>(std::istream& stream, T(&foo)[width][height])
 
k thanks
 
It's perfectly cromulent in C++ (where the term is namespace scope). Well okay, inline function definitions that depend on such a variable notwithstanding.
 
but my main question is: how can I read only specfic lines to a 2D array?
for example, I know the array is going to be a certain size
and I know the lines
 
@Link you read all lines, and put them in the 2d array if they're the specific lines you want.
 
7:27 PM
@LucDanton I will only EVAR extern variables in header files.
 
@DeadMG Error checking is different. Which isn't necessarily a bad or good thing.
 
@DeadMG I did that years ago a few times, but it didn't turn out very well in the long run. Initializing from istream_iterators provides pretty much the same capability without nearly the problems.
 
Oh hey, HIB6.
 
@LucDanton Interesting point. It doesn't quite jar with my ideas about error handling.
 
@MooingDuck, ok, i'll try that
 
7:28 PM
@JerryCoffin What kind of problems, specifically?
 
@Chimera You can't use those in constant expressions. And by the way, how do you stand on constexpr auto foo = bar; at namespace scope in a header?
 
@LucDanton Don't know, don't use C++ really.
 
Xeo
I wonder, what are the arguments against using a static local variable inside a lambda as a "member variable"?
 
@Xeo As usual, re-entrancy.
 
impurity and re-entrancy problems
 
7:31 PM
Plus, it's not a (non-static, duh) member variable. It's shared across all copies. Capture-by-copy is a better match.
 
if you want additional member variables, you can capture locals by copy
 
Xeo
We need a mechanism to bind variables inside the capture list :/
 
I can never remember what re-entrancy is :(
 
@TonyTheLion Simple- the ability to re-enter the function.
 
Xeo
[it = foo.begin(), &foo]() -> T{ if(it == foo.end()) it = foo.begin; return *it++; }
 
7:33 PM
effectively, being non-reentrant means that you can't invoke it concurrently even with totally independent data
 
Xeo
Otherwise, you need a local auto it = foo.begin();
 
also, for example, you couldn't call it recursively
 
is pandora broken or did my IT crack down on music?
 
@DeadMG ah
 
@Xeo There are worse problems. Like move-only types (which a better capture mechanism may or may not help with).
 
Xeo
7:35 PM
@LucDanton Aye
 
Arbitrary captures make lambda expressions ever closer to being literals for objects. I don't really think of it as either good of bad though.
 
@DeadMG First, you generally needed to have >> anyway, so it supplemented rather than replacing. Second, you ended with knowledge of the file format stuffed into the ctor, which I didn't really like much. I can't remember for sure, but it seems like I also ran into some oddities from implicit conversions where a string was used to create a file, and initializing from there, instead of initializing directly from the string as intended (or something similar -- this was at least 10 years ago...)
 
Xeo
I think it should help. [x = std::move(y)]
@LucDanton :)
Except that you can't access the members cleanly without returning them from the operator()
 
On the other hand, could we converge towards compound literals? I don't know, they do look ugly.
 
@MooingDuck Opening Pandora... and... works for me.
 
7:37 PM
@Xeo Obviously good for encapsulation!
 
@MooingDuck Mind you I'm running via a US Tor Exit node lol
The only thing I use IE at work for is Pandora
 
Xeo
Btw, what are return type deduction rules for lambdas again? Bared types?
 
@jornak thanks, noted.
 
@Xeo I believe so.
@Xeo Although you can extend it to cover user defined operators IIRC (using Boost)
 
Xeo
0
Q: Defining Anonymous Functions in C++

sharethisIs there the opportunity in C++ to write a function definition inline? I am not talking about functions with the keyword inline which is a signal for the compiler. What I want to do is an inline function referring to the syntax, like in JavaScript where you can write the following code ... funct...

@jornak huh?
 
7:41 PM
@JerryCoffin Hmmm. I could argue that "How to create this object from a string" is a fine thing for a constructor to know.
 
@Xeo Never mind. I think I misunderstood your question.
 
@Xeo I think so
 
@Xeo Decay rules
 
Xeo
k
 
@DeadMG When I think about it a bit more, I believe that was a problem I encountered -- the object could construct itself from a string or a stream, but passing a string literal it was ambiguous -- could be converted to either stream or string, and then construct the object from there.
 
Xeo
7:51 PM
@JerryCoffin That should only be ambiguous if the constructor takes an (i|o)fstream
 
@LucDanton Oh no, are we back to the zombie apocalypse again?
 
@JerryCoffin From a string or from a stream are two different things. I actually think I mean from a stream only.
 
@Xeo Sounds right (though this was mostly pre-standard, and I half-remember that not being entirely true at the time).
 
@Xeo Those are explicit.
Can't remember the rules, giving it a go.
 
Xeo
@LucDanton nvm then
 
7:55 PM
Ya I think it's fine. No ambiguity.
 
so I think the current T t; stream >> t; thing is bad
 
Xeo
Maybe they weren't explicit pre-standard. :)
 
but I struggled to find an alternative
 
Xeo
T t(stream);
which would, at the bottom level, solve nothing. :/
 
but I think that T::T(stream) should be fine.
 
Xeo
7:57 PM
since the lowest type would need to be constructed the old way
 
@Xeo Naw.
consider stream.read<T>();- just specialize T for primitive types
 
I have a auto foo = extract<T>(stream); thingy but the implementation relies on a constructor being present (it needn't be public though, there's an access thingamajig).
Also, I don't really make use of it. I was investigating. I don't think I've come to any conclusion.
 
well, for Wide, I need an iostream that doesn't suck
 
Default-construct then unserialise is bad.
It's hard to do properly when you don't have valid null state.
 

« first day (703 days earlier)      last day (4260 days later) »