« first day (452 days earlier)      last day (4489 days later) » 

4:00 PM
well, I guess you could argue that if you where to catch the bad index with an exception, it would be before passing it to the code that actually uses it, such as the code that reads in user input.
 
I used to write and sell C compilers for microcontrollers. I knew if I got a support call and the guy didn't know what a stack pointer was, it would be a long day.
 
@RMartinhoFernandes I didn't find it hard at all to eke out a usable reading of assembly, and I've never done any
 
I don't see any significant difference between one register-based machine assembly language and another register-based one
.NET uses stack-based VM, so it's not fair to compare it with x86
 
that's my whole point
 
@DeadMG it's useful to know more than just what each instruction does. Recognize a stack frame, for example, being able to determine where each function parameter is pushed on the stack and such. All that depends on knowing not just x86 asm, but knowing how assembly works
which you can just as well learn from ARM or MIPS asm
 
4:02 PM
if I'm a .NET guy going down to the IL, then it's not going to be very transferrable
@jalf Doesn't that pre-suppose that your function was not, for example, inlined? Or using a calling convention that passes in registers?
 
@DeadMG not really. It presupposes knowing that there is such a thing as a stack frame, and knowing that parameters can be passed on the stack or in registers.
 
Classes in my degree use Y86 as a tool to teach other things. The goal isn't to have students learn Y86, but to learn how things work at that level.
 
once you understand those fundamentals, it's fairly easy to look up the calling convention for your particular system. And the thing about inlined functions is that not every function is inlined
 
sure, but you pick those things up from doing C++
 
@RMartinhoFernandes what is Y86?
 
4:06 PM
whenever you ask, for example, about FP imprecision, the answer you get is about registers and how x87 is 80-bit and that kind of thing
 
@Abyx A simplified variant of x86.
 
user784668
@Abyx bastardized clone of x86 that doesn't exist in hardware.
 
you don't need to have studied assembly to know them
 
Well, looks like I'll be repeating this semester after all.
I can't remember any of this crap.
 
@DeadMG I disagree. You pick up a lot of small low-level factoids from doing C++, but I dare say I learned some useful things from my asm class that I didn't alreadyk now from my C++ coding
 
4:07 PM
@CatPlusPlus it can't be that bad
 
posted on January 11, 2012

Here's another reason for thinking carefully about optimizations rather than making them automatically.

 
Hi @Feeds.
 
@DeadMG But that answer doesn't tell you that x87 is a fucked-up semi-stackbased architecture ;)
 
user784668
@jalf That's why we have SSE!
 
yes
 
4:08 PM
Super Stack Exchange.
 
What do you make of this comment that "all objects should manage their own lifetime"? It sounds very unusual to me, am I missing something?
 
oh hey, this is neat
 
true
 
I can put the feeds user on ignore :)
 
but I expect that I could post a small fragment on SO and achieve a perfectly good working summary rather quickly
 
4:09 PM
@sbi, feel free to add feeds if you prefer. :)
 
lol
@KerrekSB That goes against SRP.
 
user784668
That goes against sanity.
 
Also, I have no idea how you can even begin to implement objects that manage their own lifetime.
 
@DeadMG and once again, you're moving the goalposts. My claim was that having a working knowledge of asm is useful, because @CatPlusPlus claims to have learned some asm at university, and also believes he has learned nothing useful there
 
@RMartinhoFernandes reference counter + delete this;
 
4:10 PM
whether or not you could have picked up the same knowledge elsewhere is irrelevant
 
no, I fixed them back a little earlier
 
I knew x86 assembly before that MIPS thing.
 
user784668
@Abyx who manages the refcount?
 
I'm not entirely sure what CatPlusPlus was saying, cause I wasn't paying attention
 
@RMartinhoFernandes Who's SRP?
 
4:11 PM
but all I've ever said was that studying it at university was pointless
 
@Abyx Ain't that terrible if you do something like foo x;?
@KerrekSB Single Responsibility Principle.
 
@Fanael smart pointer
 
@KerrekSB Single responsibility thingy.
 
Seriously Repetitive Programming?
Ooh
 
@KerrekSB That's Java.
 
4:11 PM
Yes! I tried to post something like that.
 
@RMartinhoFernandes factory can help with it
 
user784668
@Abyx then the smart pointer could/should delete the thing.
 
@Fanael no.
 
An object that manages its own lifetime, can't do anything else, because it already has a responsibility.
 
user784668
@Abyx Why not?
 
4:12 PM
see COM, or any intrusive_ref_couned_pointer
 
@DeadMG maybe. I found it useful. That could be because (1) my university is better than yours, or (2) I'm better at applying what I learned there than you are. I can't tell you which of those is true.
 
@CatPlusPlus There are a lot of Mips processors in the world. It may come in handy for you someday.
 
@RichardPennington Right.
 
@jalf Or equally possibly, it's simply a different era.
 
or (3) you're so much smarter than me that you don't need it
@DeadMG hey, I'm not that old ;)
 
4:13 PM
I'm not going to assume how old you are, but SO didn't exist before what, 2008, 2009?
 
When do you think I scored most of my rep? ;)
 
if my proposed alternative solution is "Ask on StackOverflow", that's only as useful as long as StackOverflow has existed
 
it wasn't after I graduated :)
 
@RMartinhoFernandes it's responsibility of its base class
 
lol
 
4:14 PM
@DeadMG There was something before SO?
 
but yeah, that's true as well. Obviously SO didn't exist when I started at university
 
@Abyx Substitution principle or whatever that thing is called.
 
@CatPlusPlus I'm serious. I have designed several devices using Mips.
 
@Feeds I don't understand the following: "The reason, of course, is that the compiler must cater to the possibility that x is an alias to an element of v, so it cannot store x in an internal register as it might otherwise have done. "
 
user784668
@CatPlusPlus LSP
 
4:15 PM
@Abyx You can't cheat SRP by making a longer inheritance chain.
 
so the reality is that if I want to know what this snippet of assembly does, I could probably get a line-by-line breakdown virtually on demand
 
but if there's one thing that characterizes most of the terrible questions on SO, it's that the OP lacks the fundamental knowledge to get anywhere on his own.
 
@RichardPennington And I don't write assembly, especially RISC one.
 
let alone my own abilities to google for the Intel reference manual or something like that
 
I'm not suggesting you should. But understanding it is a good thing.
 
4:15 PM
I have the Intel PDF manual on my desktop. Never opened it.
 
the questions that get useful answers tend to require a working knowledge of the domain on the OP's behalf
 
I don't remember the specifics, anyway, I can't remember stuff I don't use.
Well, I've looked into Intel manuals several times.
 
hmm
I'm not sure I agree
 
Don't remember specifics. Just remember branch delay slots. :-)
 
the questions that get useful answers require that the OP has accurately self-assessed his own knowledge
 
4:16 PM
and of course, you don't always post SO questions for everything you don't know. It might simply mean that certain solutions to your problem never even occur to you
 
Never heard of them.
 
@DeadMG It's ok. I agree with you that the current formal education system is an excuse for failed professionals to teach how not to fail, when they have no experience in that much.
 
Nor do I care.
I'm doomed to do webdev, anyway.
 
@jalf It is true that the xy problem exists.
 
@DeadMG and people who say "I know absolutely nothing of asm, but I need to debug this disassembly" have not accurately self-assessed their knowledge. If they did, they would try to learn some basic asm first
 
@CatPlusPlus if it makes you feel any better, I ended up being a Java developer
 
anyway, you don't need my permission to drop out of school :)
 
that's what googling "assembly tutorial" and "x86 reference manual" is for
 
@DeadMG And "C++ tutorial". I think we both know how bad an idea that is ;)
 
heh
I don't think they're really the same thing
 
4:18 PM
@jalf Sounds like it's time for an A&Q site, ala Jeopardy.
 
Knowing where to look for information is more important than trying to remember every single thing, IMO.
 
of course not
but that's because you already know C++, and know enough to determine that tutorials suck
 
no
 
user784668
@jalf and assembly is much less complicated, it's harder to screw up a tutorial.
 
the difference comes because to debug my function, all I have to do is read what the compiler has already written
I don't need to design or write it myself
 
4:19 PM
@CatPlusPlus that's not an excuse for not learning though.
also, I think there's a difference between "learning" and "remembering"
 
Everything is an excuse for not learning.
 
@jalf No, that is an excuse. Learning as you do is far more effective than a classroom environment.
 
I managed to learn how to read without needing to "remember everything"
 
@CatPlusPlus education sucks, get over it
 
Classroom is outdated, because now we have enough wealth to put people in the field during their education.
 
4:21 PM
@CatPlusPlus The branch delay slots are a good example. It is very difficult to read Mips assembly if you aren't aware of their existence.
 
@thecoshman I'll get over it when I'm over with it.
 
But you donj't have to memorize the opcodes.
 
@CatPlusPlus then get on with it :P
 
I would say that more accurately, the classroom is outdated because the field no longer has significantly less information available
 
I can't! My brain shuts down.
I can't focus on the bloody thing.
 
4:22 PM
@CatPlusPlus turn it back on then :D
 
when I'm in the software engineering "field", as it were, I can still be here and ask the robot parsing questions just fine
 
@DeadMG outdated compared to what? Compared to "learning what I want to learn and what I think will be relevant", it's as useful as ever
 
@CatPlusPlus The most I got out of professions teaching programming concepts, is how to NOT do things, by avoiding what they did. Simply put, all education classes are giving society is a laziness for self-education.
 
Compared to "1-on-1 learning with a dedicated mentor", it's as outdated as it's always been
 
@Xaade Ok, we get it, you had a crappy education.
 
4:23 PM
@jalf I think that a literal, physical classroom is unnecessary.
 
12 years of school taught me to hate school in every form.
 
@CatPlusPlus what about the hot teacher form?
 
self-education ftw
 
@DeadMG So can a plumber. And yet, most people would consider you (even with all your flaws) a more valuable programmer than the plumber
 
Wait, not 12. 14.
 
4:23 PM
I could do a module from the University of Melbourne from my home in Dorset if I wanted to
 
It's not just about knowing where to find information
2
 
@jalf No, you can't ask me plumbing questions.
 
yes, that is true
and I'm not going to pretend that Stack Overflow or any Internet resource can make you an instant guru
 
@thecoshman Meh.
 
Knowledge is not the same as wisdom
6
 
4:24 PM
however
 
@DeadMG Karma = guruness measure.
 
there are things which are vastly more amenable to being applied with much less classroom knowledge
 
Take those autistic chaps, most of them are very very knowledgeable (on very very specific things), but I bet none of them are wise
 
@jalf That's never what you get. What you get is a stupid degree that requires you to suck up to a grad student teaching English 102, which should be writing fluffy paragraphs 102, a bunch of general science information you throw out before you finish your final, a bunch of advertisement for other degree offerings, and a few generic classes on technical writing (done too generic to help with documentation of source), and an ethics class with a professor basically saying "Don't be an asshole"
 
and there are some things for which you need more
 
4:25 PM
@DeadMG Yeah, and part of the knowledge backing up the replies to those parsing questions came from a classroom.
 
Who've calculated an integral outside of school in the past year?
 
true
 
any way, It's time for me and my 'on the fence' comments to head home :D
 
but I don't need to attend the classroom to benefit from your attendance of said classroom
 
see ya
 
4:26 PM
Then you get to the meat of your degree, which focuses too much on teaching a specific technology, and giving you A+s for projects that work, rather than teaching good architectural skills in design.
 
and here's the reality: I can (probably) access five people who've attended a class in any subject I might care to pick on SO
and as long as it's true that people who took a class in subject X, and people who took a class in subject Y, can effectively share their knowledge
say, through a programmer's networking site
then there is little need for any specific knowledge to be taught through a degree programme
 
@RMartinhoFernandes No, I had a great education. I'm talking about the pitfalls of the concept of education in general. In other words my education was the best that education can offer, which still sucks at accomplishing anything.
 
what would be much better taught is general knowledge, like, "Don't use global variables", "You ain't gonna need it", "Memory indirection is slow", etc.
 
does this channel now grow
 
4:28 PM
@DeadMG Turn a SE degree into "An Acronym A Day"?
 
@DeadMG that's still too specific.
 
today, I ask you about LR parsing, tomorrow, I tell some other guy about DirectX shaders, and the day after that, he tells you about, I dunno, OpenGL shaders
 
@DeadMG: Memory indirection is slow?
 
@JohannesSchaublitb What do you mean by "channel"?
 
compared to what?
 
4:29 PM
@DeadMG it better to teach why "Memory indirection is slow" - teach assembly
 
And that doesn't teach a person how to develop good code, that teaches a DO-NOT list, which will end at some point and leave people hanging when a new problem is discovered.
 
@Grizzly Compared to "no memory indirection"!
 
@RMartinhoFernandes No, although commonly-used acronyms do correspond to good principles worth knowing
@Abyx You don't need assembly to teach that at all.
 
@Etienne i mean a virtual something that directs messages from different people to one another and has a topic that determines the general direction of thought in it
 
@Xaade Those were just the first ideas to come to mind. You can replace them with any general principles you want.
 
4:30 PM
You can teach about memory indirection using the C++ abstract machine.
 
@JohannesSchaublitb Oh, you mean like the Lounge? Except the Lounge has no topic.
 
user784668
0
Q: How can I delete dynamic array pointer correctly

Lion KingI've Created dynamic array, and I added values ​​to the values ​​of the array like that. int *pArr; pArr = new int[10]; for(int i=0;i<10;i++){ pArr[i] = i+2; } delete[] pArr; // After deletion I can find the value of the array items. cout << pArr[5] << endl; As you see i...

 
@EtiennedeMartel IRC lingo. I bet he types /join #Lounge<C++> to enter this room.
 
@RMartinhoFernandes no. it's too far from reality
 
yes it has.
 
user784668
4:31 PM
Close it for being a zillionth duplicate, please.
 
I'm thinking more generic, like "Don't use what you don't need". "Simplicity is best". "Keep up on technology". "What's wrong with this program". "Common pitfalls of developers in all languages". "Discrete Math". "Computation". Optional Matrix based maths. At least some background in statistics.
 
@Xaade Common sense?
@Abyx It's not. My friends got memory indirection just fine with C and no assembly.
 
@RMartinhoFernandes Only because it isn't too common anymore.
Here's the deal.
 
In retrospect, naming it delete might not have been a good choice.
 
What makes a programmer a good programmer.
 
4:33 PM
SO Rep.
 
Having a discrete logic behind what they build is a good start.
 
for java tag
 
but anyway
 
I think, for learning indirection, it helps to see a translation to assembly language (and have that explained)
 
the fundamental problem is the mismatch, IMO, between the employer and university's expectations
 
4:34 PM
So far, the average programmer out of college is a wrench monkey with ample supply of duct-tape.
 
the university wants to teach a super-academic degree course in CS, and the employer wants to get a graduate with a degree in useful SE
 
unfortunately, the university already won and nobody told the employer
 
@AlfPSteinbach You don't need assembly. Assembly is instructions. To teach memory indirection you only need a suitable memory model.
 
duct tape is engineers best weapon!
 
4:35 PM
@DeadMG Yep. The huge majority of what I've learned in university hasn't been useful in any of the internships I've done.
 
@EtiennedeMartel: So what would you have named it?
 
the trick is to apply what you learned
not to ignore it
 
I don't ignore it, I just forget it
 
@DeadMG Then we need more than one CS degree. We need degrees with far more electives that must be taken in a path together. Like instead of choosing each elective, you choose a branch of electives.
 
@Grizzly free. But since that's already taken, I'd say release.
 
4:36 PM
@RMartinhoFernandes well need and "need". i think it helps. at least it helped me, and my students. and good old niklaus wirth designed pascal to be easy to translate manually to assembly, by students. which they did.
 
it's called having separate CS and SE degrees
 
Then get right down to major divisions in industry, and specialize.
@DeadMG What good would the CS degree then be, other than a liberal arts degree.
 
@EtiennedeMartel In my first week at work ever, I fixed a performance issue by changing an O(N^2) algorithm to a O(Nlog N) one. That knowledge came from university.
 
@DeadMG That's what my university does: there's a CS degree in their faculty of science and a SE degree in their faculty of engineering.
 
@JohannesSchaublitb: Really, for many things I've learned I found ignoring it is the only sensible choice
 
4:37 PM
that's the university's problem as far as I'm concerned
 
for some jobs like compiler building or nagivation tools you need CS
 
the employers, and the students who want to be employed, need SE
 
for the "soft" things you may get away with not using the university stuff
 
@DeadMG Mine is a big mixture of the two.
 
@RMartinhoFernandes you'd know it even without university
 
4:38 PM
The other things were mostly stuff I already knew from other sources, or things I'll probably never need
 
what the university and their academic programs do with CS isn't my concern
 
I remember as a student (1983?) doing things with variant records in Pascal in order to do pointer arithmetic, and not understanding any of the asterisks * in Systems Programming Language (SPL for HP3000). The syntax of SPL was at wrong level of abstraction. And not well explained by the docs.
 
@Xaade The fact that I could or could not have picked up that knowledge somewhere else doesn't make teaching it useless.
 
@RMartinhoFernandes So basically, you did a quick google search on sorting algorithms, read from a book on algorithms, or asked a question on SO. I fail to see how that gave you an advantage over some other Joe.
 
user784668
SE? What's that?
 
4:40 PM
Software Engineering.
 
Also, I didn't google anything. I looked at the code and saw the quadratic behaviour and knew that was the problem to fix.
 
@RMartinhoFernandes No, I'm saying the classroom has been obsoleted by the availability of information. The classroom either needs to be in the hands of industry, or it needs to be a generalized study of 2 years.
 
Oh @RMartinhoFernandes you should not have reminded me of student days, with terminals. One fellow student did a practical joke on me. He'd switched the keyboards for my terminal and the of someone I was working with. When we came back after a pause and sat down at the terminals, what appeared on the screens didn't quite match what we wrote... Huh???
 
@RMartinhoFernandes And, I'm saying that I could gain the knowledge to recognize that in one one-page article on Wikipedia.
 
4:42 PM
@Xaade why do you think, it should be generalized?
 
if you don't do something you will be poor
so you need to work to get money. basic principle.
 
Unfortunately.
 
I got a technical degree in CS in college, and the stuff I learned there was much more useful than the stuff I would end up learning later at the university level. In college, I learned about programming in a few languages, some basic concepts, and most importantly, how to learn.
 
I don't know how to learn, apparently.
 
4:44 PM
@bamboon I don't. I spent one year in college repeating high-school (because I took college level in high school and the college didn't like that). I spent one year in college learning some math. Then I spent two years in college learning relevant information in my field, of which was mostly theoretical and didn't apply because I got a job at a company that doesn't design anything.
That's broken. I try to figure out how to fix it.
 
@Xaade So you suggest that people just spend two years at home reading the Internetz?
 
School should give you a starting point, then tell you where to go if you want to learn more.
 
I second that motion!
The reading for two years one.
 
@CatPlusPlus Reddit and TVTropes, you mean.
 
And 9gag.
 
4:47 PM
Though that would probably take all fun out of it.
 
I don't need the 1 year of repeating high school. High school needs to step up and deliver calculus to all students. I don't need the 1 year of general studies, I simply don't care if I can impress a English professor who can't really tell me how to fix what I didn't do right (English as an art is fluffy. They can't even tell you how to write, they can just write red ink and look like they teach something). I needed that good Senior year.
 
I hate doing things I'm forced to do.
 
Are there any standard semantics for formatted iostream extraction when the operation fails?
I.e. if you clear the error, are you guaranteed to resume at the point of failure?
Or could some partial data already have been extracted and lost?
 
@Xaade See, you now sound again like you're complaining about the bad teachers you had.
Also, I have no idea what things like "Senior year" mean.
 
Senior year, I took a class in statistics, which changed my entire outlook on data in general. I took a class in discrete math, which helped me with formulating systems. I took a class in computation, which helped me in understanding how to create state information, and the difference between stateful and stateless. I took a class in .NET, which helped me in languages that I use in my job.
 
4:50 PM
Following the latest comment, is COM a good 00 design? I never used it.
 
not really
but it has some rather unusual requirements
 
@RMartinhoFernandes But, it's the college philosophy that nurtures bad teachers. The teachers themselves weren't bad (the ones that had a hand in teaching the useful classes I took), but the college concept of well-roundedness led me to being taught writing by a Grad student that "can't get an A in her own class", mostly because she doesn't have a discrete method for recognizing a good paper.
 
delete this? is that even allowed?
 
it's allowed.
 
@Grizzly It's allowed, but it feels like a terrible responsibility car crash
An object cannot create itself, so why should it destroy itself?
 
4:52 PM
It's like explicitly calling the destructor , I don't see any point to doing so
 
There must be a creator around somewhere who already has that responsibility.
 
@KerrekSB listen to James Kanze. he really knows what he's talking about. but also keep in mind that he's one of the few who has depth experience with garbage collection in C++, so that some of his opinions don't square well with what most C++ devs think.
 
@RMartinhoFernandes Senior year is the last year in college. Whether that's your third (if you took 18+ hours), fourth (if you took min hours), or fifth (if you took more than required, or failed a few classes).
 
@Pubby It's rather different.
 
@KerrekSB Aside from freeing the memory?
 
4:53 PM
@AlfPSteinbach OK... I just struggled to find a good design example which could make use of self-destruction.
 
I would have thought it isn't since the code is tstill in a method of that object after its lifetime ended
 
@Pubby Destructors have nothing to do with memory
 
@AlfPSteinbach i remember James trolled me back in usenet on that sequence point thread
 
@KerrekSB Reference counted objects are about it. Also objects that represent GUI elements. I can't think of more, but I'm tired + a large pint of beer for dinner...
 
in my language runtime i'm using "delete this;" for the string COW buffer and the array/tuple COW data buffer
 
4:55 PM
@AlfPSteinbach Try meat and vegetables. They might not seem as appealing as the liquid bread at first, but they're better long term ;-)
 
@KerrekSB First time I hear "liquid bread" to refer to beer. I prefer the term "liquid steak".
 
@AlfPSteinbach But the reference-counted object must still be owned by someone, non?
 
@KerrekSB it owns itself
 
@KerrekSB heh, i meant along with dinner. which was a pretty advanced chicken thing. at first it was impossible to find the chicken, underneath all the cheese sauce and mushrooms and bacon
 
@EtiennedeMartel In most countries beer is made from grain, much like bread, but I guess meat-based alcohol would be awesome, too.
@AlfPSteinbach Ooh, OK
 
4:56 PM
@KerrekSB In COM, you manually call AddRef and Release to notify it that it's being used/stopped being used.
 
It's essentially ref counting without smart pointers.
 
@KerrekSB if he body is ref countd, it is convenient for the handle to say "body->unref();" and let unref() "delete this" if necessary
 
@RMartinhoFernandes But who is "it", and who made "it"?
 
@RMartinhoFernandes in C. in C++ smart pointer calls AddRef/Release
 
Same thing happens in Objective-C with the retain and release methods.
 
4:57 PM
@KerrekSB ... uh.... You only need destructors to release held resources. Which is memory. You mean: Destructors have nothing to do with the owner's memory.
 
@JohannesSchaublitb Yeah, I can see how that could be done, but somebody would have to make the body.
 
usually the handle makes it
 
@Xaade Yeah, of course. The members can be anything, that's opaque.
 
body::create();
 
@Abyx If you're slapping a smart pointer around it anyway, isn't the smart pointer the one actually managing the object's lifetime?
 
4:58 PM
@JohannesSchaublitb Ahh! The static creation fiasco :-)
 
"whoever news it should delete it" is a nice principle but I think it can be violated in practice and don't cause harm
 
@KerrekSB I suppose he's talking about shared_from_this/intrusive_ptr like idioms
 
@KerrekSB i'm not sure what you say there
why is a "body::create" function a fiasco?
 
What's so great about the object managing its own lifetime, if you're going to use a smart pointer to manage the object's lifetime?
 
But storing refcount inside the object is not really the same as object managing its own lifetime.
 
4:59 PM
So, if you have a static create function, then for this self-destructive pattern to work you'd require the caller of create() to not acquire responsibility?!
 
@AlfPSteinbach You need a few more animals in that concoction.
 
It's the core problem with naked pointers: They have no ownership semantics and require meta information (e.g. a design document)
While an semantic pointer is self-documenting
 

« first day (452 days earlier)      last day (4489 days later) »