« first day (830 days earlier)      last day (4344 days later) » 

Ell
Ell
19:02
I don't understand why people find pointers difficult
in my mind it's extremely simple
11
A: Do the young minds need to learn the pointer concepts?

FredOverflow Why did the C master Dennis Ritchie introduce pointers in C? Because pointers are a very powerful mechanism that can be used in many ways. And why did the other programming languages like VB.NET or Java or C# eliminate them? Because pointers are a very dangerous mechanism that can be m...

`struct C {
virtual void f() = 0 { }; // ill-formed
};`
This is not good?
If you use pointers for a specific purpose, they're easy to understand. For example, I teach students iterators, and they have absolutely no problems with placing the asterisk correctly. But raw pointers are such an extremely "overloaded" concept, that I can totally understand why pointers confuse noobs.
pw means porn wish, right?
19:04
right
@FredOverflow IME it's the multiple meanings of * and & and silly people right-aligning them in typenames that causes the most initial confusion.
@Non-StopTimeTravel right aligning?
@Borgleader Apparently not but you can define a function body outside the struct definition if you like.
@JohannesSchaub-litb litb
19:08
@AndreiTita Yeah that's what I ended up doing
what is a dereference should look like one
IMO
@JohannesSchaub-litb there is no dereference in int*.
user142019
Are we seriously discussing insignificant (as long as consistent) code style. ~_~
There is no dereference even in int* foo;. You shall not change my mind on this!
You are absolutely right - what is a dereference should look like one, and what isn't, shouldn't
@Non-StopTimeTravel in int * foo; there is a dereference
19:10
@Zoidberg it's either that or unicorns
@Zoidberg yes, I like punk.
foo is dereferenced to yield type int
user142019
I'd rather discuss unicorns then.
@JohannesSchaub-litb Not in int * foo it isn't. In *foo, it is.
Telling people that a declaration is also a dereference operation is just flat out lying to them! Exactly the sort of confusion I'm referring to
user142019
Follow code style guideline and problem solved.
19:11
Yes, I understand the original rationale behind having the syntax like this.
@Zoidberg As long as it's mine :)
user142019
No the one your project uses.
@Non-StopTimeTravel i dare to dissagree
user142019
I.e. the one used by the first non-moronic guy who wrote code for the project.
user142019
If all code in the project does T * var;, and you write code for that project and don't do T * var;, you're an idiot.
@Non-StopTimeTravel That is a lot of words about one character
user142019
19:14
If you're the first author of a project use whatever you prefer.
@CatPlusPlus Yep
@Zoidberg It's not that important
@CatPlusPlus I am a distant descendant of Shakespeare. He did that too.
T* var; for declarations, *var for dereferencing. This makes it easy to refactor.
Not really, no
19:15
Everyone is wrong except me and @ThePhD. Just get used to it, guys.
\*[A-Za-z][A-Za-z0-9]* <--- Dereference
[A-Za-z][A-Za-z0-9]*\* <--- Declaration

I'm not saying I'm right, it's just how I think of it.
i prefer to write int *a; and a[0]
user142019
lol refactoring using regexes.
user142019
@JohannesSchaub-litb lol
user142019
> OVERHEAD. COMPUTER NEEDS TO + 0.
19:16
int * b
template <typename T> using ptr = T*; // woop no asterisks
Way too much overhead.
quiz: if a is an struct A*, what is the difference between a[0] and *a ?
@CatPlusPlus Hax.
user142019
@JohannesSchaub-litb fdsfdsdfs
user142019
19:18
STOP CHANIGNG THAT ALL THE TIMe
sorry, I reworded
operator precedence?
Why are you using the prefix struct in C++?
@JohannesSchaub-litb You can reverse the syntax like 0[a], but you cannot write a*? ;)
just to show that it's a UDT?
user142019
@Non-StopTimeTravel To make things clear. ~_~
2
Q: Avoiding an "inheritance by dominance" warning for a mocked std::fstream class

emddudleyI am using googlemock to mock out an std::fstream object in my unit tests, like this: TEST_F(SomeTest, SomethingIsDoneCorrectly) { class MockFstream : public std::fstream {}; MockFstream lMockFstream; // Expectations and assertions here } When I compile I get the following warnings...

lol
@Non-StopTimeTravel You might want to look up the Schaub at the main site at this point
@sehe I've known litb for years so, no need.
user142019
I prefer T* var; because I like how that is consistent with T& var; and I find T &var; disgusting.
19:20
@Non-StopTimeTravel "Yap", FTFY :)
@sehe Doesn't mean I have to agree with him on style.
@JohannesSchaub-litb The former is an avalue, and the latter is a pvalue? ;)
user142019
In C I use T *var because it has no references.
@FredOverflow both are lvalues
@Zoidberg Why do you need raw pointers in C++?
19:21
@Non-StopTimeTravel Indeed it doesn't. Frankly, I thought you were new here. I though it funny that you linked to Tomalak's site :) hahaha. I see now
user142019
@FredOverflow pointer to parent in a tree, for example.
template<typename T> using raw = T*;
user142019
Or when doing obscure things.
@FredOverflow there is a subtle difference that can yield to a compile time error in certain circumstances
19:22
@sehe people link to my site! sometimes!
user142019
Interfacing with C code.
user142019
T* foo;
my_c_function(&foo);
std::unique_ptr<T> bar{foo};
yes, let's all use ptr<T>, ref<T> and so on as alias templates and get rid of T *x
@JohannesSchaub-litb it strikes me that it probably has been years, huh
Apr 13 '12 at 15:11, by sehe
@RMartinhoFernandes Oh. Like that. I tend to fully disregard avatars :(
19:22
@JohannesSchaub-litb And I always thought p[0] and *p meant the same thing for raw pointers.
- readable
- no confusion when declaring multiple vars
- doesn't look like a dereference
user142019
@JohannesSchaub-litb not verbose enough.
Can I use CGI scripts to write a simple text board or is that stupid? I don't really have any idea how to webdev.
@JohannesSchaub-litb I very much like that idea.
@JohannesSchaub-litb *(p+0) and p[0] are defined to be equivalent!
19:23
@FredOverflow there is a subtle diff. the quiz is to find out what it is
@JohannesSchaub-litb No. Instead it looks like a template.
user142019
non_owning_raw_pointer<T>
@Non-StopTimeTravel but not to *p!
user142019
@Pubby you can, but I'd never do that.
But ref is already taken in the context of binders IIRC.
19:23
@JohannesSchaub-litb indeed
user142019
Using a microframework like Sinatra, Flask or Express is much easier. And it supports connection pools and whatnot.
i shall not tell you the solution
@FredOverflow It's std::ref though.
@Zoidberg Learning some newfangled web language doesn't sound easier.
(also what's a connection pool?)
user142019
What language do you want to use?
19:24
@LucDanton in the face of ADL... (ref)<T> wouldn't really work that well
template<typename T> using id = T;
id<int*> oh, my, god, five, pointers;
@Pubby a pool of connections
user142019
@Pubby you have a fixed number of DB connections instead of connecting to the DB on every request. Similar to a thread pool, but with connections instead of threads.
@sehe hee hee
@Pubby Doing CGI to make anything of value is retarded... It's so old, and so difficult to make it work properly...
19:25
@Zoidberg C++ is the best I know. I don't really know if I even need a DB.
user142019
lol web dev in C++.
@JohannesSchaub-litb And there's a compile-time error in one case? Hard to believe. Does it have to do with sizeof?
@Pubby Confirmed troll.
It doesn't have to be C++, I just don't want to learn PHP!
user142019
What other languages do you know?
19:25
p[0]++ doesn't work the same as *p++
@Zoidberg C!
/me has cheated
Web dev, making a forum, in C++/CGI, without a database? XD
user142019
lol
@Collin Good catch, but that's not always a compile-time error. Depends on the type of *p.
user142019
19:26
Use Ruby on Rails.
@Collin That's not going to give you a compilation error though
@FredOverflow he is right but that is not the solution
@Non-StopTimeTravel It will if the type does not support increment.
i mean to talk about this expression. obviously when used in a larger expression, parens are needed
@FredOverflow you had a good catch with sizeof
so in fact when you have struct incomplete_class; then you can say *p but not p[0]
19:27
@JohannesSchaub-litb It was just a gut feeling, let me think about it some more...
user142019
$ rails new forum
$ cd forum
$ rails g scaffold Topic title:string body:text parent_id:integer
user142019
Done. :P
@JohannesSchaub-litb Ah okay, that was fast.
@JohannesSchaub-litb because the +0 can't be done on an incomplete type?
19:28
@Non-StopTimeTravel in fact
Ah, of course!
@Zoidberg Isn't that for more dynamic content though? I just want 1990 BBS functionality.
user142019
How is a BBS not dynamic content.
user142019
I'd use Perl.
@Zoidberg I don't know. I've always heard 4chan referred to as static pages.
user142019
I want to learn more about Perl.
@EtiennedeMartel Here
user142019
Use Haskell!
19:29
@Pubby So you want CGI and C++ crap to write new posts, user data, and passwords to flat files or HTML pages?
but why could you do *p on an incomplete type?
@Pubby Ultimate confirmed troll. moot just gave 4chan a full Web 2.0 makeover.
@Collin Why not? *p doesn't really do anything.
@Non-StopTimeTravel i should not have given the solution
@LucDanton Do we install it only on the clients?
19:29
@Zoidberg Actually, the main text board uses Perl (it's called Kareha). I could look into that.
@EtiennedeMartel No.
I got to admit I have near zero experience with mods
@sehe Are you around?
now someone will post them over to it and get rep
@JohannesSchaub-litb You do it
19:30
@JohannesSchaub-litb You do it
@EtiennedeMartel FTB means using the FTB launchers which means bliss.
@FredOverflow Oh, as long as you don't assign it, it won't actually try to dereference?
@Collin Look at the generated code for *p;, it doesn't do anything.
19:31
I trolled @ShotgunNinja and I wasn't even trying!
@Non-StopTimeTravel lol i deleted the comment :)
Where can I upload the server jar so that I can give a link to sehe?
Oh wait nvm, the config is important too.
for an incomplete type
you can do T& t = *p;
@JohannesSchaub-litb bah :P
@DeadMG oooh
@JohannesSchaub-litb Okay, I summarized what you guys wrote :)
19:34
wait, if it's incomplete, how does sizeof(*p) work?
Doesn't sizeof(e) requires that the type of e must be a complete type? Otherwise this would make no sense... — ybungalobill 53 secs ago
That seems like a good point
@LucDanton yup, loosely
@DeadMG's reference example may make more sense
@sehe Ah, do you think you can proceed with some set up for the server? This might require some time, it's not just copying a jar over.
@Collin It doesn't.
19:37
@Non-StopTimeTravel lol -6. you my friend are way too frank. they don't like frank riddles
they are just jealous
I was just writing up an answer, too
4
A: What is the difference between `*a` and `a[0]`?

FredOverflowIf A is an incomplete type, *a works, but a[0] does not in this example: struct A; void foo(A& r) { } void bar(A* a) { foo(*a); foo(a[0]); // error: invalid use of incomplete type ‘struct A’ }

@LucDanton I might. How much ram is realistically gonna be needed? I might wanna relocate. Also, I can only do "no-guarantee" hosting. But that probably goes without saying
found new example
@ScottW Hi Frank
19:39
Ah, Fred got there just in time
@ScottW No, how is not in
for the record, I got to:
Fred was close.

He was on the right lines with the incomplete type business, but `sizeof` requires its operand to have a complete type. However, reference binding does not:

struct A;
A* a = get_from_somewhere();

A& a =
@sehe Dunno. Let me fire my laptop and load a world. Also I was assuming the same regarding the latter.
@LucDanton charge? that showed gallicism!
@FredOverflow i sense a gold badge for you
lol
19:40
@sehe I hope that's infrequent.
@JohannesSchaub-litb hehe
@LucDanton It is. You could have fool me
-9 for a good question
tossers!
I shall blame this on my postprandial torpor.
So, how do servers using stuff like rails and php maintain state?
19:42
@Pubby sessions
@LucDanton I generally allocate 2 GB, but that's for vanilla. I don't know if mods increase memory usage.
@Non-StopTimeTravel Yeah, this is no style. We need some serious upvoting power here. It may not have much practical value, but the question is rather unique and probably lacks a good answer, findable on the net
@JohannesSchaub-litb What's the opposite of a gold badge? I sense that for the question, lol
@LucDanton Your ... whaat
19:42
@sehe Me ate lots.
@JohannesSchaub-litb The semicolon is a nice red herring :)
@LucDanton Yeah, google told me that :)
"Uh.. this is dumb, but x = 2." lol
1
A: What is the difference between `*a` and `a[0]`?

Nikos C.The difference between *a and a[0] is: *a - a[0];

19:44
lol
@FredOverflow I believe that's correct.
Okay so I went creative and flew around to load chunks.
Though I think it needs an abs() since I believe "difference" is the distance between them. (the positive distance)
@sehe Remind me again which column of top is relevant for our purposes here?
@Mysticial Arguably it could mean vector distance rather than scalar distance
19:46
24
A: What is the difference between "\r" and "\n"?

dreamlaxThe difference between '\r' and '\n' is 3.

OK, but you can still overload for A* at global scope. — user1610015 2 mins ago
(wikipedia): "A rhetorical question is a figure of speech in the form of a question that is asked in order to make a point and without the expectation of a reply.". That does not match this question, because it appears that a reply was expected. What of the other points that make it "not a real question" applies? — Johannes Schaub - litb 17 secs ago
thank you!
@Mysticial Why isn't the 3rd one upvoted much? It's the best answer!
ahhh I love being divisive. 3 reopen votes, 1 delete vote, -7 net score.
@LucDanton I'm eternally unsure, I'd say RES in htop. Lemme see
@sehe It's below 600MB
19:48
is there a badge for a high abs(upvotes-downvotes) value?
@Non-StopTimeTravel If there was, I'd probably get one.
Guys, I think I'm addicted to p_orn. Where _ stands for opc.
I'm half expecting the mods to delete the question on their own. They like doing that...
@sehe It peaks below 700MB when going through portals (which, if that graphing thing is any indication, is memory intensive).
19:50
RSS
BTW FTR the SO chat search facility is excellent.
@LucDanton which one? the gnome-system-monitor thing? Or on windows?
In fact I've always held the chat software in the highest regard, in general.
@Non-StopTimeTravel cough. you mean, has it changed?
@sehe server gui has a graph.
19:51
@Non-StopTimeTravel Do I still get the rep?!?
@LucDanton Oh, don't have a giu. Running on ssh/screen
set -o vi
@sehe I couldn't remember my idea for an April Fool's post for 2013. So I took a chance that search at the top RHS of this page would do a clean search of this room's historical transcript for me. And it did. Clean results page, nice little links. Persons, times.
Fammit I want Vi keys in chat
@FredOverflow If?
Oh
You wouldn't in that instance, no
@sehe How do I get that?
19:52
@Non-StopTimeTravel Nooooo
@LucDanton ps -v $(pgrep java) here
@sehe what do you get for 14 a month?
huh...
@sehe ~675000 but I'm not on the server right now. Do I need to benchmark that?
@FredOverflow I think we're safe for now.
I shared it on Twitter for good measure ;)
@LucDanton No, a nice 'stab' at it will do. Lemme find a server with enough capacity. If I have one...
19:54
@sehe If you don't mind, here are the server files.
@LucDanton Done (grabbed)
you still playing with MC stuff?
ooh , mindcrack
@sehe Need some guidance to get the ball rolling from here?
@LucDanton Dunno. Let you know. Finding a server first
how many do you have man?
19:56
@thecoshman I figured since there's three of us that know of it and it is painless to use. And/or we can switch to any FTB-provided modpack.
@JohannesSchaub-litb Why does your quiz not work on ideone? Do they disable the crucial part?
@FredOverflow i think GCC defaults to disable trigraphs
@thecoshman I mean, we had a short stab at vanilla but let's face it: it sucks!
@Non-StopTimeTravel What is this, an attempt to take over the world with stupid quizzes? ;)
@LucDanton if it wasn't having problems atm, I would offer to open up my FTB server to you lot
19:57
@JohannesSchaub-litb yup
@LucDanton who's IceKeese?
@sehe Etienne
@FredOverflow Funny you should ask. I was just trying to figure out what the next one should be ;)
@FredOverflow hmm works on LWS with "-std=c++11 -pedantic -O2"
I might steal the trigraphs idea
1. Ask stupid C++ quiz on stack overflow.
2. ???
3. World domination!
3
19:58
@FredOverflow What do you mean not work?
@Collin It should print 1 ten times.
fun. Clang doesn't warn about the trigraph, but instead warns about the "multiline comment", not saying how it happens to become one
@FredOverflow wat
@FredOverflow nonono. it should print 1 one time
19:59
@Collin The ++x is part of the multi-line comment introduced by the trigraph ??/. So the loop body is the print statement.

« first day (830 days earlier)      last day (4344 days later) »