« first day (82 days earlier)      last day (4857 days later) » 

12:00 AM
Having something mine getting in Boost would be more than enough for me :)
 
From a usability point of view, I don't mind the iostreams library. Most of the I/O code I've written has been pretty mundane, though.
 
Obviously there are things we'd do differently now: operator void*() ?
 
And the damned exceptions which are active only "by kind request"!
 
I'm not convinced about sync() / pubsync() .
 
Well, yes. But now (in C++0x), we would certainly just use an explicit operator bool().
 
12:03 AM
Exceptions should just be left off in iostreams, IMHO.
 
It would be nice if something similar to Boost.Format became standardized. IMO, it would be better if formatting and I/O were distinct.
 
The naming is a bit suspect. Quick, what's the difference between uflow() and underflow() ?
 
@CharlesBailey I've never turned on the iostreams exceptions, though I have a set of wrappers to do checked extractions and throw if extraction fails. I find them very useful.
 
@CharlesBailey I don't know... having exceptions when something really bad happens is good
 
@MatteoItalia Yes, but do you really want while (in >> obj) to terminate with an exception just because you've reached the end of stream?
 
12:05 AM
not for an EOF, but an extraction failure requires some "stronger" signal than changing the internal state
@CharlesBailey: I was writing that while you posted your message :)
 
Much better (IMHO) is for application code to determine what IO failures truly are exception and throw something more meaningful.
 
@CharlesBailey Not always, but sometimes you do. If you're reading from a file that has fixed-length fields or some other kind of structured data and you reach EOF before you expect to, then yeah, an exception is warranted.
 
Having exceptions on extraction errors surely would save us lots of "my code runs forever if I put a letter instead of a number" :)
And there should be a damn method guaranteed to clean the input buffer
 
anyone know a good place to get help with amazon ec2?
 
@JamesMcNellis Yes, but I'd prefer to decide to raise that in application code. I tried iostreams with exceptions turned on once and, at least for what I was doing, it just ended up a lot less neat than with them off.
 
12:10 AM
@CharlesBailey Right; I agree. A set of helper functions is useful for this, though. Do such helper functions deserve to be standardized? Probably not.
 
@CharlesBailey: actually I too had a similar experience; so all in all I don't know what's worse. :)
Completely unrelated: yesterday a person on another forum was building yet-another-vector-like class, and was asking if it was possible to have the non-const version of operator[] called only when an assignment was being done.
My idea was to have a proxy object returned by the non-const operator[]
 
Bad names 101: showmanyc. So bad there's a non-normative note telling you how to pronounce it.
 
which overloaded the conversion operator to the base type, so that it called the code intended for the read-only access, and the operator= for the write access.
 
@CharlesBailey Ha!
 
@MatteoItalia Reference proxy object is the only way I know of and is usually not worth the effort. It's almost impossible to make it totally transparent.
 
12:13 AM
310) The morphemes of showmanycare ‘‘es-how-many-see’’, not ‘‘show-manic’’.
I've never really dug into the iostreams library. I tend to avoid iostreams questions on Stack Overflow because I just haven't used them much.
 
@Charles Bailey: actually, this works fine as long as you don't want to use compound-assignment or increment/decrement operators; and even if you implement them, if you're writing a generic container the compilation will fail if the base object doesn't support such operators
 
@JamesMcNellis And working out what you should make it return if you override it isn't obvious either.
 
I think that there's no way to perform such a thing, but maybe someone here has some super magic trick... :)
@JamesMcNellis: another area of the standard library I fear is all the <locale> stuff.
 
@MatteoItalia There's a locale library?! ;-D
 
@JamesMcNellis Everyone should implement a zlib streambuf for transparent compression through iostream interface; it's quite enlightening.
 
12:16 AM
@JamesMcNellis :)
 
@JamesMcNellis Yes, it's got an "interesting" interface use_facet, anyone? But the biggest deficiency is that it tends to be so badly supported.
It's a total fail on MacOSX.
 
@CharlesBailey I'll add that to my list of "things that would be interesting to implement in C++." The list is getting long, though; it may be a while.
@CharlesBailey I think the only times I've seen facets are in Stack Overflow answers by Jerry Coffin.
 
One thing they should really add to the standard library
is some decent date-time handling. Every time I have to use <ctime> I die a little.
Did Boost.DateTime got incorporated in C++0x?
 
Datetime is really hard to do well.
Why was the October revolution (Russia) in November?
 
@CharlesBailey I know, but everything is better than gmtime/localtime/struct tm and all that nonreentrant stuff. :)
@CharlesBailey There has been a time when I knew it, but I can't tell you when it was if you don't tell me what's your calendar :)
 
12:24 AM
Does anyone know why the C++0x regex definition is a modified version of the ECMAScript regex definition? I read the spec for the modifications but couldn't interpret a rationale from them.
 
@CharlesBailey Does the TR1 spec say anything?
 
Dunno, which number is TR1?
I've got a folder with about a dozen n\d{4}\.pdf files.
 
Dunno, I don't have a copy of the documents at work. (Well, except N3225)
 
@JamesMcNellis You mean you only read them for fun at home?
 
guys
0
Q: Examples of ISO C++ code that is not valid C++/CLI

Johannes Schaub - litbI've seen contradictory answers on the internet with regard to whether CLI is a superset of C++ or not. The accepted answer on this question claims that "technically no", but doesn't provide an examples of non-C++/CLI code that conforms to ISO C++. Another answer on that question cites a book t...

 
12:30 AM
@CharlesBailey I don't use C++ at work, so, yeah, pretty much.
 
@JohannesSchaublitb I hope there's a counter example, a proof that every well formed C++ translation unit is valid C++/CLI would be hard.
@JamesMcNellis From where I'm standing there's no way I can accuse you of being sad so I'll just offer you my condolences for your lack of C++ at work. On the plus side, at least your colleagues can't insert bad C++ code into the project you're working on.
 
@CharlesBailey No condolences needed; I knew what I was getting into when I accepted the job :-)
 
12:46 AM
i guess at MS they are working all with C#. except the core windows group is working with C++ and C
 
@JohannesSchaublitb I think that in Office, Exchange, MSSQL, ... and a lot of other MS software there's still lots of C/C++ development going on.
 
@JohannesSchaublitb Well, the project I'm working on is in C#; if I had to guess, I'd guess that most development is still in C++.
 
1:09 AM
@JohannesSchaublitb Do you have Chipotle in Germany?
 
1:51 AM
@JamesMcNellis never heard of that
 
 
1 hour later…
3:07 AM
@MatteoItalia #include <chrono> in C++0x might be the salvation.
 
 
6 hours later…
8:58 AM
hey guys :)
anyone here? ^^
 
@Beasly I am here :D
 
good morning :)
i have a question but dunno how to call it... maybe anyone has an idea...
i have a console app... it's running fine if i debug it... but if i let it run "on its own" it fail with an error...
thats wired
 
9:16 AM
error msg is: This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
:(
 
@Beasly What's your OS, compiler... IMHO, that might be caused by invalid memory access. You probably access memory address which not yours, or double released a memory.
 
windows xp, eclipse with minGW
@yoco but why then the error doen't occur while debugging...?
 
9:57 AM
that's easy: because the debugger affects something related to the bug :)
the hard part is determining what that is
 
@FredNurk and now? ^^
 
now what?
 
@FredNurk actually i know where it happens...
but i dunno why...
i'm in a meeting for 1/2 hour...
 
sbi
10:50 AM
@CharlesBailey And what a mess IO streams are! With good() not being the opposite of bad() (in fact, the whole mess of !istrm vs. istrm.fail() vs. !istrm.good(); ever tried to teach that to newbies?), implicit conversions, a totally needlessly overloaded operator, the silent ignoring of errors, the mixup of buffering and device IO... IO streams actually are a pretty good example of bad design all across the whole thing.
 
@sbi Yes, there are some interface warts but I still wouldn't call it an ultimate mess.
 
sbi
@Charles Then I take it you have never had to teach them?
 
@sbi Not in a formal academic way.
 
sbi
I have, but it's not the formality that was a PITA, it's the newbies, coming from languages like Java or C#, having all the right to be utterly confused.
IO streams are a good idea that never got overhauled, and carries the baggage of 2.5 decades with it.
 
hi all
my error in the edit of this question has absolutely baffled me
0
Q: boost::function assignment to member function

TonyI want to use a boost::fucntion and pass it to a function to function as a callback. I seem to be having some trouble assigning the member function to it. The function that I want to pass it to is a static function (as it is invoked on another thread). boost::function<std::string (ResolverR...

can anyone help?
 
sbi
10:55 AM
HI @Tony, I'm bashing IO streams. Want to join?
 
yea
 
sbi
Oh, you got your own question...
 
streams confuse me
especially overloading operator << or operator >>
 
sbi
@Charles See?
Oh wait. @Tony But these are the easiest part of stream...
 
well, I thought that operator << was for putting into a stream, but that does not seem so
or have I got it wrong?
 
10:57 AM
@sbi: @Tony has admitted to using features before he's learned how to use them so I don't hold too much weight to his confusion.
I'm not denying that iostreams have some warty interface baggage but I just don't see the rubbish overall design that some others do.
 
sbi
@CharlesBailey Having taught C++ for years, and having been online in different kinds of forums for almost two decades, I can assure you that this is the common, not the exception.
And how else could it be? C++ is complex enough a beast for us old-timers to learn something new every week. If you want to only use it after you have fully grasped it, you could never start!
 
I probably wouldn't have made a single streambuf class server for both output and input for example so it feels a bit un-neat to write a read-only streambuf.
 
sbi
@CharlesBailey Yeah, that's what MI is for, right?
 
@sbi No, I don't think I would have have tied together input and output at any point with MI.
 
sbi
Well, if you read and write to the same, say: file, using the same buffer for both seems good, no?
 
11:03 AM
@sbi Yes, I would probably have an iofile object with some sync functionality with a getter for both an output and input buffer interface.
 
sbi
@CharlesBailey How is it better to get() an interface from an object instead of the object's class just implementing it?
 
@sbi Perhaps it would make sense to use MI at this point in the tree, I haven't though it through in excessive detail; I do think, though, that it would be better to have the put and get/putback virtual functions in separate interfaces. I would call this a major design flaw with the current design, though.
 
sbi
@CharlesBailey I agree with that. (Note that I'm not generally opposed to getting interfaces. I just don't know what it would get you.)
Also, why do I have to implement a buffer, when all I want is to write to a specific device? That mixing of buffering an device IO is annoying.
 
@sbi At least you're backing up your assertions; most people just seem to rant about iostreams and I think they do a pretty decent job considering how old they are.
 
sbi
Well, I guess instead of bashing IO streams, we should form The New IO Streams Cabal and write a good replacement. And in ten years' time it might get standardized. Or not. Bugger.
 
11:12 AM
@sbi Yes, although nothing is stopping you from writing a utility base class that handles the setp / setg and internal char buffer, just letting you do the "real" work of overflow and `underflow`once per device. (Actually, I'm fairly sure that boost supplies a lot of such helper classes to make life easier.)
 
sbi
@CharlesBailey Don't get me wrong: I actually prefer IO streams over printf() and its like. I never bothered to learn anything beyond "%s" and "%i", and claim that using basic IO stream formatting isn't much harder than printf(). That doesn't mean it doesn't need improvement, though.
@CharlesBailey TBH, I have little idea what you're talking about here. Yes, I've heard all the functions' names, and implemented all this myself at least once or twice. But never without Langer/Kreft.
The stream buffer interface is nothing you can look at and know immediately how to use it.
 
@sbi Agreed, they could definitely be improved; the biggest annoyance is that many improvements would be to remove some warts and break existing code.
 
sbi
@CharlesBailey Which is Why I think inventing a new IO lib might be the way to go. People are using C IO and C++ IO, often enough in the same application. I see no problem in adding another one.
 
some serious streams discussion here, wish I could 'stream in", but I'm not smart enough
yet
 
It's just a stream of conscious.
 
sbi
11:21 AM
@Charles You can edit your messages for a while, you know?
 
@sbi "edit" is very close to "delete".
 
sbi
Actually, "cursor up" will edit you last message. See the newbie hints I linked to on the right.
 
it's unfortunate you can't use a familiar chat program and must learn a new interface :(
 
sbi
@FredN Yes, but the interface doesn't seem so hard to use, no?
 
apparently it was hard enough you felt compelled to write newbie hints :)
 
sbi
11:33 AM
Yeah, but that's just a replacement for the missing/hard-to-find help. And it's very small.
 
really it doesn't matter how hard (or not) something is to use – if it breaks what I'm accustomed to, then it's additional mental tax. the cost of doing that is usually higher than anticipated
obviously I'm still here, so the benefit of talking with you guys is more than the cost (at least for me), but I can't imagine I'm the only one frustrated from time to time
actually, I often go days at a time without being here, and the above is definitely one of the reasons why (though I probably don't consciously realize it every time), just because I'd rather not deal with it. while I'm always on IM, checking email, etc.
 
sbi
12:06 PM
Hi @FredO! Instead of Singletons, we're now bashing IO streams. Want to join the party? It got kind of down right now. Do you have something fresh to add?
 
@FredNurk After having used the SO chat for some time, I cannot stand IRC anymore. I really like being able to fix little mistakes after having sent them.
@sbi Speaking of IO streams and Singletons, many Java -> C++ migrators apparently believe that std::cout is a Singleton :-)
 
sbi
@FredOverflow I know the feeling. I now hate it how everything is set to stone once you hit the commit button on Usenet. And I keep searching for the upvote button whenever I see something good on the web...
 
@sbi Yeah, just yesterday I wanted to upvote something someone wrote on IRC :-)
 
sbi
@FredOverflow Ha! It's even worse! It's a - gasp! - global object!
 
@sbi I prefer global objects to singletons :-) .
3
 
12:10 PM
@sbi OMG, this is not OO, what are we gonna do about it? Pass references to it everywhere?!? <holds breath>
 
@FredOverflow I wasn't thinking of irc (though I do use it); incidentally, I make more mistakes because I know I can fix them – not sure if I like this result or not :)
 
@CharlesBailey Upvoted. Ah, that feels good...
 
sbi
@FredOverflow Although U really hate it that you can't down-vote comments: stackoverflow.com/questions/4608763/…
That guy's just plain wrong. but there's no way to vote it down.
 
@sbi Has down-voting comments ever been suggested at meta?
 
@sbi: incidentally, I don't downvote, and would (mildly) espouse that others consider not to as well
 
12:12 PM
@sbi Also, what is c0x supposed to mean? :-)
@FredNurk Why? Downvoting is an integral part of keeping SO clean from nonsense.
 
is it really?
 
sbi
@FredNurk Yep.
 
@sbi I have flagged the wrong comment as "noise, offensive or spam". That should take care of it.
 
downvoting is not deleting, which would keep SO clean
and you should always be wary of deleting when it might only be on the basis of conflicting with your ideas
 
@FredNurk Most people are smart enough to delete their crap once it's exposed as such. There's even a badge for that, "Peer Pressure" ;-)
 
12:15 PM
@FredOverflow: yes, let's just remove him instead of helping him learn. (in re flagging as spam)
 
@FredNurk Better have him learn nothing than confuse hundreds of potential readers with his nonsense.
 
i'm back :)
 
@FredOverflow you both grossly overestimate the influence of that question and didn't notice sbi already replied with a correction
and when you discount teaching the asker of the question by that much... there's something wrong
 
sbi
@FredNurk Yes, but as long as nobody else chimes in, it's just my assertion (Beware, brain-compiled code ahead!) against his.
 
@FredNurk Oh, I didn't notice the comment was written by the asker.
 
12:18 PM
@sbi: so people have to think? shock, horror :)
or rather, your downvoting his comment (if that was possible) comes across as "people shouldn't think, they should just take my word for it", which, I hope, isn't what you want
 
Here is another nonsense comment: stackoverflow.com/questions/4614687/…
 
Grrr, not only fails to answer the question, but gives an incorrect answer and gets upvoted. stackoverflow.com/questions/4614453/…
 
@CharlesBailey secret to getting c++ rep without real work: quote the standard :)
 
@FredNurk Well, you still have to find the appropriate sections. That's not trivial most of the time.
 
@FredNurk Quoting the standard is real work! It's taken me years to get this good at it.
2
 
12:25 PM
@CharlesBailey you're including understanding the quote and it's context to make sure you have a correct answer :)
 
@FredNurk Silly me, I thought that was implied :) .
 
@FredOverflow (and that's the real non-trivial bit)
@FredOverflow which comment?
I think you mean the pointers-are-ints comment, but in the context of a debugger (e.g. Tony's comment on the question) that's how it often works
that answerer obviously has a lot to learn, but I don't see how downvotes (on the answer or comments) would help
 
sbi
@FredNurk Well, good answers/comments can be distinguished from bad ones by their vote count difference. I wouldn't want to up-vote a mediocre answer just to make others see the difference to a bad one. So I down-vote the latter. With comments, I have no choice but to up-vote even mediocre comments, just to make them stand out more than the bad ones.
 
no, that doesn't distinguish the good from the bad, it only tells you how people voted
some topics on SO get much more attention than others (e.g. c# vs c++), so you can't use absolute vote counts in any case and must compare by differences. thus, perhaps it would be better to sometimes consider how one answer/comment fits in with others close to it when deciding how to vote, rather than "is this answer/comment, in isolation, worthy of a vote"
people to do that already in some circumstances: it seems people are much less likely to vote when something is at +11 than at +1
 
sbi
2
Q: "Close as duplicate" - what if only the answer is a duplicate?

jalfI know it's already established that duplicate questions should be closed but not deleted, so they can act as "pointers" to the one canonical answer. However, I think there's one important aspect that is usually glossed over: lately I've run into a number of instances where questions have been ...

@FredNurk Of course. But, in general, votes are a good indication as to the quality of the thing voted on. I vote for things I consider good, anyway, an I have the feeling I'm not the only one.
And I haven't talked about absolute vote counts. (Those would have to be weighed against U.S. waking hours, for starters.) I talked about the votes of one answer/comment in relation to another one's.
 
12:41 PM
considering an answer in isolation ("I wouldn't want to up-vote a mediocre answer...") is evaluating whether that answer is worth its score (and, especially, +1 to that score) in isolation: that's talking about absolute vote counts
did I misunderstand that you would rather decide to upvote or not based on the answer in isolation, rather than in comparison to other answers around it?
I'm not saying you're wrong about downvoting, mind, my "(mildly)" was very much intentional and perhaps understated; but I do like talking about such things and hope you do too :)
 
sbi
I want answers I consider good to bubble up, and answer I consider bad to sink down. If a bad answer already got -5, I don't bother. If, OTOH, it has +3, I will down-vote.
 
what if it's +3 next to only one other answer which is at +100? has it not already sunk down and something better bubbled up?
are you using absolute score or relative score?
I also want good things to bubble up, but I'm not sure I want non-good things to sink down. I upvote when I see something I like. when I see something I don't like and I think it would be an effective use of my time to make a suggestion, correction, or warning to others, then I'll comment
 
1:01 PM
could anybody suggest how to solve this: fatal error LNK1104: cannot open file 'libboost_date_time-vc71-sgd-1_44.lib'
I have had this before, but I can't remember how I fixed it :(
 
does the file exist where the compiler is looking for it?
 
I haven't found it
i'm guessing that might be the issue
but why has it not complained about it before then?
 
(it would be more helpful if some message was included about why it couldn't be opened, even if only the generic OS-level diagnostic, e.g. strerror)
 
I've been using boost::date_time for ages
 
if you've only been using header-only features, you might not have needed the .lib before now
 
1:03 PM
this is the only thing my compiler spits out
 
if you want to find out whether you needed the .lib in the past, check out an older revision and see if it compiles :)
 
sbi
@Tony That's one of the few boost libs that comes with cpp files which you must build into a lib.
 
but really, you need to find out where the file is supposed to be, and put it there if it's not
 
@sbi I guess you have to build it from cmd line?
or is there a vc project I can build?
 
boost uses a special build system, you're better off downloading the already built version
 
1:08 PM
ok
@FredNurk, @sbi thx for the help
solved the problem
:)
 
how did everyone get so good at C++. i'm depressed. i've been learning for 3 years and i just seem to be getting myself into a deeper quagmire.
after 3 years should one not have improved somewhat?
anybody there to give a pep talk to a dejected C++ developer?
nope.
bah
perhaps i need counselling instead.
bah
 
1:23 PM
@BeeBand
what have you been doing?
professional projects? or your own projects?
and by what are you measuring your improvement?
 
Both - I started a professional project about 6 months ago. I am the sole developer on it. Its a game engine ( well a set of tools ).
 
ok
 
I was learning via Accelerated C++, Effective C++ and writing my own 2D game.
 
so what is the problem you're having, besides the fact you think you're not improving?
 
And I suppose I'm measureing my improvement by looking at all the really basic questions i seem to be asking... and then looking at the advanced discussions in the chat room and thinking ... crikey.
well my main issue is with design - i never know when to stop and say "ok that's good design". and then i become slow.
 
1:26 PM
C++ is not an easy language, and writing a game engine even harder
 
@sbi: I understood, and meant my last comment with the same tongue-in-cheek (or rather a different tongue, I have my own after all) :) (re stackoverflow.com/questions/4608763/…)
 
@Tony. right.
i'm a C dev. and i do python. C++ just takes it all to a new level of complexity.
 
@BeeBand design is my problem too, but then i realize at some point one has to settle with the design there is an continue and keep going
hmm I get it
 
yes
 
is there some basic concept you don't understand about C++ perhaps?
 
1:30 PM
yeah. well someone gave me an answer today, and mentioned about how Init() functions called from a constructor should always be private and i'm like ... how can anyone remember all of this? and I think that's a really basic concept i've missed...
 
you just need to keep at it and validate all the bits you do learn, even if its the smallest thing, something learned = win!
 
@BeeBand C++ has a lot of faults, both in the infrastructure (e.g. the committee) and the language; you're not the only one frustrated
 
@Tony. i guess. yeah.
@Fred oh really? ok. i didn't realise.
 
wrt the committee specifically, keep in mind that detail is more or less from 1990; it's just how ISO works
 
you mustn't give up, you see I have had some very frustrating times, but I then give myself a break and see where I can learn something and continu
 
1:31 PM
and it's why python (for example) can come up with new features, implement, bugfix, polish, and then release within a year or two, but C++ needs 5-10 years
 
@Tony - thanks. i was thinking of giving it all up.
@FredNurk i see. So, you think that C++ has an "unrefined" nature perhaps and this adds to the complexity of learning it?
 
not unrefined
 
right
just complex?
erm... ok no i'm not making sense.
 
@BeeBand it is a matter of persistence, you just have to keep at it. Never stop learning, read another book, ask questions, browse forums, etc...
write code (perhaps the most important)
 
it's not a simple issue, but is one reason, for example, that the C++98 standard library was so small
 
1:34 PM
@Tony I think you're right. write code. i take too long because i want to get it all right.
@Tony and so i probbably don't write enough. i admire those people that can just churn out lines and lines in like a day.
 
you have to be willing for it to go wrong while you code and then fix it, don't strive for perfection, cause it will drive you nuts
 
compare to something like python, perl, java, or c#: it's much harder to get something done only using "official/standard c++" (which holds water with some people, but not me), but more importantly leads to fracturing as people use different libraries for, e.g., threads
 
@Tony. yes indeed.
 
both of those issues (even the one I consider counter-productive) are barriers for newcomers to the language
 
its not like I churn out that much, but I do write code and debug and write more code and ask questions, read books, etc
just view it as a game
sometimes you lose a little and you can win again
ignore the losses and strengthen the wins
:)
 
1:36 PM
@Tony - aha yes. i think i'm losing the whole "this is meant to be fun" element.
 
I actually really like programming! honestly.
 
@BeeBand good! That's a good start
 
@BeeBand don't get caught up in arguments that drain the fun – which is easy on a site like SO
 
Enjoy what you do! no matter how frustrating
 
1:38 PM
@FredNurk nice link.
@FredNurk - well yes. it's the endless debating sometimes.
 
yup, just refuse to get involved
you'll be happier, and healthier (literally), for it
 
thanks guys. well i'm gonna get back on the horse ( as it were )... my lunch break's over. thanks a lot.
 
:)
 
Hey guys! I stumbled upon a concept in OOP that I can't name... Maybe you can help me
When you have a variable in a inner scope with the same name of a variable in a outer scope, you can't access the latter
in C++, at least. I know in Java that's an error
 
"name hiding"
the inner name hides the outer name
 
1:47 PM
name hiding! Thats a simple name, lol
 
can't say it is often named "name hiding", but the verb "hides" is frequently used as in the second statement
 
I remember learning the concept in college, but I couldn't for nothing remember the name.
thanks!
is that exclusive to C++?
 
fwiw, "hiding" is also used for derived/base scopes in the same way, even though that's subtly different from inner/outer scopes
no, names in inner scopes hide outer scope names the same way in python, probably many other languages
 
Oh, I think I found the "official" name for this pattern: variable shadowing
In computer programming, variable shadowing occurs when a variable declared within a certain scope (decision block, method, or inner class) has the same name as a variable declared in an outer scope. This outer variable is said to be shadowed. This can lead to confusion, as it may be unclear which variable subsequent uses of the shadowed variable name refer to. One of the first languages to introduce variable shadowing was ALGOL, which first introduced blocks to establish scopes. It was also permitted by many of the derivative programming languages including C++ and Java. The C# languag...
 
2:03 PM
you can't have an official name for something spanning so many languages :)
but yes, that's the same thing
 
Oh, I just saw that you can do variable shadowing in java, but only with class members. Does that mean that inside a method you have only one scope? Or better yet, that scopes are delimited by methods only?
 
I have no idea how Java is specific in this regard, sorry :)
 
oh okay
I may ask this question in the Java chat room, hehe
 
 
2 hours later…
3:38 PM
lol @CharlesBailey . the guys on IRC always beat me up when i say "I prefer mynamespace::object" over a global object.
 
if you have a static function as part of a class, it means that running this will not be thread-safe in a threaded environment. But what happens to variables initialized in this function (assumed static I guess) when the instance of this object is destroyed?
of course the static function isn't called on an instance
 
2
A: What's your favorite "programmer ignorance" pet peeve?

Johannes Schaub - litbIn C++: Myth: std::getline is a global function. Reality: std::getline is not a global function, but a function defined in the namespace std. There is a common believing that things that are defined in namespaces other than the global namespace are all global. But in fact, that can cause conf...

lol
 
@JohannesSchaublitb add static to it for me :)
 
@litb: NIIIIIIIT-PICK!
 
not a nitpickat all
 
3:50 PM
a pick nit
 
the C standard library puts its name into the global scope. not the C++ Standard. huge diff dude
 
@JohannesSchaublitb are you talking to me?
 
@Tony: he's talking to me
because i said he was nit-picking
 
@JohnDibling ok
ha ok
 
I guess I evoked Grumpy Behavior :)
@litb: I get the difference. I'm not saying that there's no or marginal difference a function being at global namespace scope and non-global namespace scope
 
3:54 PM
so if there is a non-marginal difference, it isn't a nitpick, i think
 
And I'm not saying you're wrong, either.
But it's still a nitpick.
 
<strike>thanks for finally agreeing with me</strike>
darnit :)
 
Because when people say "global function" it is commonly understood to mean "function at namespace scope" as opposed to "function at class scope". That's incorrect, but a well-understood misunderstanding. Part of the lexicon, if you will. So yeah, you're right when you say that getline is not a global. But to say that it's your pet peeve when someone says "getline is a global" seems very language-lawyerly and nitpicky to me.
 
I have a tendency to call an abstract class a virtual class. Which can be problematic...
 

« first day (82 days earlier)      last day (4857 days later) »