« first day (33 days earlier)      last day (5141 days later) » 

00:02
@JerryCoffin, I'll have to take your word for it
... I hope John wasn't referring to my "Eiffel ftw" remark
@avakar No, I think John was referring to the general low s/n ratio in C++ discussions. There is simply so much to disagree about, because C++ is based on giving you the freedom to do anything Your Way(TM). :-)
@AlfPSteinbach ah, yeah :)
@tina Good 1-hour past midnight!
00:30
@avakar BTW, should we be welcoming you back? Today seems like the first time I've seen any posts from you for the last few weeks or so...
@JerryCoffin partly, it's because I've been busy, partly it's that since I've reached 10k rep I'm not as motivated to write answers anymore
I do come here regularly to read though (and comment :) )
Today I actually came to ask a question and I'm hanging around waiting for responses
@avakar What q?
1
Q: Why is box sizing set to border-box for tables in Firefox?

avakarThe title says it all. I found that making a table with <table style="padding-left: 100px; width: 200px"> makes the content only 100px wide. Further investigation revealed that Firefox has table { -moz-box-sizing: border-box }; rule in its default stylesheet. Is there a reason for tha...

not C++ related :)
@JerryCoffin, yeah, C++ equivalent of sscanf is still missing.
I'm hungry. afk
something akin to boost::format would be nice
00:44
@avakar Yeah -- C++ iostreams do have advantages, but for some things, they're just a pain...
@tina I don't think there's a tool for anything in vs6
you'd probably use some uml software
or visio
a sequence diagram doesn't need to show tiny things like macros and pointers, just the general flow of events right?
01:05
@tina: possibilities: (1) code was written by Ungood Programmer(s), or,(2) it was intentionally obfuscated (to be difficult to understand), or (3) both. Anyway, it's sort of impenetrable code. The way I'd go about it would be to copy the system and transform the code to something more clear, preserving its functionality exactly.
What conditions?
well, the func_id does not seem to be defined in the code you've shown, so presumably this is an internal routine called by some routine that sets the func_id.
@tina I've worked on GIS code very similar to the spaghetti you've shown. I could not decide whether those guys were psycho or inordinately incompetent or both. I thought the project lead joked at the interview when he remarked that the crash didn't matter because they'd turn off assertions before delivering to customer (which was the Dutch military); it turned out he was serious.
yes
oh, the complexity in the code you've shown is not about that. it's about unclear responsibilities (especially initialization responsibilities), failure to abstract, failure to encode types as C++ types, failure to use built-in control structures, failure to name things properly, failure to observe basic coding guidelines, failure, failure, failure
01:23
@Alf, haha, yeah, and they use switch/case ;)
i think you have to to make sense of the code. that is, don't assume that there's a good reason for anything. rather, assume that the original programmer was nitwit.
@avakar :-) yes, but it might be appropriate in this context. although using a member variable as a global is not
:_)
@AlfPSteinbach I don't know what you mean by "member variable as a global". The code does look terrible, though.
@avakar A member variable as a global is a member variable that does not hold any part of object's state, but serves to communicate information willy-nilly between member functions.
@tina: huh?
01:39
@AlfPSteinbach i see. I actually do that in my code as well, even if in a little more controlled manner. What do you think about this: github.com/avakar/stanse/blob/master/src/cppparser/…?
a have a lot of stuff to pass across function calls, the stuff is enclosed in context class
the functions are members of context
and i perform everything in a constructor
(the top-level function is at the very bottom)
Not sure about that one. It's different in that the whole point of context is to hold contextual information, and the info is initialized in constructor. So you don't wonder where a value came from. Hopefully. Question whether all that functionality really needs all that info.
hmm
anyway, it's almost 3am here, going to be
d
:)
good night and see you later
02:09
@tina about "member variables as global variables" i was talking metaphorically, that they're used in the same way as some people use global variables. like, if member routine A calls member routine B, then A puts a value in a member variable (like func_id_), and B picks it up. perhaps only in that particular call chain is the value meaningful. perhaps it even means something else in some other call scenario. you don't know where values come from by local inspection of code.
02:21
@tina yeah. it's late. i'm sorry i was perhaps a little grumpy here. anyway, good luck with your analysis! afk
02:32
@sbi I think the issue with my post has become very controversial. So it would be better to leave everything as it is.I am ok with everything. :)
 
1 hour later…
03:54
hello
04:25
Madames. Monsieurs.
je ne parle pas français
hey guys.... you willing to answer a few questions with just plain ol C?
shoot
Ok so as a warning I'm a beginner :)
Just learned about structures in my C programming class and I have a structure city_t which is a city that contains the subvariables:
CityName; State; Population; Ranking; and PercentChange
I'm going to be reading in a file that contains 10 cities with each variable defined in a .dat file
My question is that when ever i read in the file I use a while loop that loop through each entry of the file and reads the variable into whatever I'm using it.
since I'm going to be reading it into an array of 10 city_t structures, how do I distinguish between each subvariables of the structure
that make sense? @FredNurk
city_t data[10]; // now you have data[0] through data[9]
I'm guessing typedef struct { ... } city_t;, without the typedef, that's struct city_t data[10];, but accessing data is the same
be careful of string handling, otherwise it's a straight-forward use of an array
data[0].Population, or .Ranking, or .CityName, etc. will access the members
04:44
but as I'm accessing the file I'm accessing cityName first and then State and the population....etc
How do i save to each of those variables as it is looping?
by using a ton of if statements?
seems like there should be an easier way
for example if filescanning for strings I would use:
city_t data[0]; FILE *file = fopen(...); for (int i = 0; i < 10; i++) { read_city(file, &data[i]); }
void read_city(FILE *file, city_t *dest) { /* read each member into dest->CityName, dest->Population, etc. */ }
I've omitted error handling, which is rather important
@sbi: What is "the v arrow"? do you mean up arrow? (referring to the message at the right)
@KronoS: that should be data[10], not 0
so sorry if this is the noob in me but I'm not sure about what should be put into the read_city body
becuase each variable a different class
int, char, double... etc
it depends how your data file is laid out
fread, fscanf, and related would be used
note how fscanf takes a formatting string so it knows the types it needs to read
while fread is for reading "raw" bytes
if, for example, your data file was written in json or yaml, you'd use a library that knows how to read those data formats
here's what I was doing to read strings into the program:
while(1)
{if(feof(inp)) //inp is the file read into the program
break
else
fscanf(inp, "%s", s); //s is the array that I'm saving the string into
you need to check fscanf's return code to see whether it failed
you shouldn't need feof
understanding how to correctly use fscanf is, unfortunately, a common tripping point for new C programmers
04:59
again not being an expert in the least way I'm not following... I though that feof(inp) meant end of file
This was given straight from the teacher lol
doing file IO is probably the single most common problem when learning how to program
In Soviet Russia, template instantiates you!
3
feof does detect if the last input operation hit EOF (end of file), but not whether the next will succeed
in soviet russia, old memes joke with you
if the last hit end of file then why would next succeed?
@KronoS: it wouldn't, but to use the data read by the last operation (in the last iteration of that loop), you have to already know if it worked or not: fscanf tells you this directly with its return code
so feof simply isn't needed
05:02
oh...
if your data is line-based, you should also look at fgets
Oh. When was Jeff Atwood here?
for a fleeting moment that only a few were privileged to see @wilhelmtell
i was not one of them :(
click the "1d ago" link; I'd be tempted to apply for that tech review, if I thought I had a chance :)
@FredNurk what's the dif between fscanf and fgets?
05:04
@wilhelmtell Yesterday.
sorry again for the noob questions :) just trying to learn and understand
LOL Deitel books are beyond repair, sorry ... :p
oh nevermind I remeber from class now... it reads it as a line @FredNurk
@wilhelmtell I think that would make reviewing the book all the more fun. I have a large supply of red ink.
@JamesMcNellis lmao
05:07
but the info is like this:
I was looking through older editions of the book. They've had a lot of distinguished people review the books.
Of course, the fact that they paid people to review it does not imply that they actually fixed any of the problems.
@KronoS: it looks like you're expected to use fscanf to read multiple fields at once
@KronoS: it may be simpler for you to read a single line into a large enough buffer (e.g. char line[200]; is plenty big enough), then parse that line with sscanf
sscanf?
that one I know hasn't been brought up...
it's just like fscanf, but works on char arrays instead of FILE*
remember C-strings are just char arrays; the first 's' of sscanf stands for string
all c strings are just char arrays?
05:12
"C-style strings", commonly called "C-strings", are just char arrays, yes; they are expected to be null-terminated ('\0' is the null character), or used with a size specified
oh got it....
I recommend not searching for "C string" at work.
@JamesMcNellis lol
So let me see if I got this:
1. read the file in a line at a time by saving it in a buffer string
2. read each line(string) a variable at a time
3. save variable to structure array's correct subvariable
4. repeat for each line until end of file is met
4. repeat until reading a line fails
@FredNurk oh right...
05:16
1-2 can be replaced by a single fscanf call (whereas 1 is fgets and 2 is sscanf); I suggested reading a whole line and then parsing it because that breakdown can be simpler to understand early on
you will actually have knuth's "loop and a half", which in languages like C looks like an infinite loop with a break in the middle
can you give a simple example?
pseudocode: while (true) { read_some_data(); if (that_failed) break; use_data(); }
you can examine fscanf's (or fgets's plus sscanf's) return code to see whether they failed
@FredNurk ok I think I've got the basic idea. I'm going to go and code a bit and see if I can get a better idea of it...
thank you so much!
welcome
never understood why people are so hesitant to use namespaces
0
A: Why and how should I use namespaces in C++?

Fred Nurk Aren't name collisions enough of a reason? ADL subtleties, especially with operator overloads, are another. That's the easiest way. You can also prefix names with the namespace, e.g. my_namespace::name, when defining.

does anyone have experience with PEG parsing or C++ libraries for PEG?
A parsing expression grammar, or PEG, is a type of analytic formal grammar, i.e. it describes a formal language in terms of a set of rules for recognizing strings in the language. The formalism was introduced by Bryan Ford in 2004. , and is closely related to the family of Top-down parsing languages introduced in the early 1970s. Syntactially, PEGs also look similar to context-free grammars (CFGs), but they have a different interpretation, which is closer to how string recognition tends to be done in practice, e.g. by a recursive descent parser. Unlike CFGs, PEGs cannot be ambiguous; if a...
05:44
this SO thang is addictive
06:36
Hey tina API is application programming interface. It's just a fancy name for a library
@FredNurk Yes. Yes it is.
DP is fun
1
A: minimum difference between sum of two subsets

Fred NurkYes, a dynamic solution is possible. I'll use code to explain the recursion: def solve(numbers): print numbers memo = {} def D(index, a, b): """Return minimum subset-sum difference. Using numbers[index:], split each into either subset, with a and b representing the current s...

07:03
I should probably never comment, seems the top users rarely do; and people are so ready to jump down your throats for no reason: stackoverflow.com/questions/4212248/to-check-the-end-of-arrays
@tina: I have no idea what that is
@James: do you think I'll get any upvotes on my alternative answer to this? Seems lately I've written better and better answers, with lower and lower upvotes as result...
@tina I only know a little bit after skimming some papers the last time you asked
@Alf: I'd like to have your rep and this lower upvotes "problem".
@FredNurk It seems you've only been registered on SO for a day?
@Fred: The reason I jumped down your throat is because you took the opportunity to tell the newbie coder that he was wrong, but didn't bother to tell him how or give him any information that he can use to get a better understanding. Seemed like taunting to me. Like pushing a blind person in to a wall.
so you're complaining because I left a comment instead of an answer?
07:09
@tina do you know what the 9 intersections are, in geometrical terms?
@Fred: And you're wrong about the "top posters" not commenting. Many of the posters you refer to comment more than post, IMO
@tina well, that's all I know :-)
*shrug* I'm just briefly looked at them, then you had a problem with me pointing out the specific misunderstanding (which I still don't understand), and it appeared they answer more often
@Fred: leaving a comment and no answer is fine. when that comment seems designed to do nothing but insult the OP, that's what I have a problem with
@John: what is the insult in "you are horribly misunderstanding X"?
07:12
@JohnDibling I think Fred must have done som good answering with 209 points in a day. I've only had 5 or 6 days over 200 points, in a bout one and a half month here...
@tina i'm taking you seriously, and i think, so are we all. but we're not good enough or we lack the specific knowledge to understand what you're really asking.
@Fred: if you need to ask that question, then all I can say is you just don't get it
maybe you see what i did there
so 1) you insist I've insulted that guy, but 2) cannot point out the insult
I guess even SO has trolls
@tina only from what you've told here. i don't understand this problem about 9-intersections. possibly it is a problem about understanding code that does it. if so, put the code on pastebin or somewhere?
@Fred: See?
I just did to you what you did to the poster, and you called me a troll for it
now, guys, now now... :-)
07:16
no, you did not
@Alf, yeah, I'm done for tonight
if I have misunderstood something, please point that out
saying "no, you don't get it" is not pointing out what I have misunderstood
@John: If you object to my use of "horribly", just say so; I half expected that, but it's a single freaking word in a comment and directed at the code, not at the OP, for crying out loud
@FredNurk Without trying to get into whether the comment was good, bad or indifferent as it was given, I do think it would be more useful to the OP if you made at least some attempt at correcting their misunderstanding instead of just pointing it out.
before I could even finish reading all the answers, @John jumped down my throat
nice welcome, that
@Jerry: do you find it insulting to point out the specific misunderstanding?
@FredNurk I don't think it was intended to be insulting, but I can easily see how it could be perceived that way. I think for the OP, it probably depends on whether he's already frustrated from struggling with this. If he is, it'd be a bit like the line from the old joke about "you're in a balloon" -- perfectly correct, but utterly useless.
07:29
@tina I'm still not sure what you're asking, but my impression of the code is that selects a string of 9 characters, each character, F or *, denoting whether a particular one of the 9 intersections is at all possible. Input parameters 2 shape kinds, output string possible intersections. -- Or, that's my guess. :-)
@Jerry: That only seems like the insult is that I posted a comment instead of an answer. I knew I wasn't answering and a quick scan of the answers showed there was much confusion: I wanted to point out the specific problem before I even finished reading, much less post my own answer
@FredNurk Just let it lie. An insult is an insult if receiver thinks it's an insulted. I always insult people east and west. They get over it, I get over it. We're happy. As a matter fact I think that both Jerry and I have insulted each other many many times over the years. Not to mention that I once really really insulted Andrei Alexandrescu. Apparently he forgave me. :-) Happy.
@Alf: it wasn't even directed at @John
@AlfPSteinbach How could you accuse me of insulting anybody, you lying sack of garbage!
2
07:37
Hmm...I do have a talent for bringing the conversation to a screeching halt, at least for a while, don't I?
yes
right regarding what result string you get. regarding interpretation of result string, to be sure i would look up some articles on 9-intersection. there is a standard approach, with associated notation, data structures etc.
well, frankly, the whole notion of intersection of boundaries, and the notion of a geometrical point having a boundary or interior, does not make much sense to me. perhaps a "point" is really a "pixel" or some kind of smallest region? i don't know this stuff, i only have a vague geometrical understanding
ok, in that case its intersection with anything can be only a point, or nothing.
as i see it.
then conclusion is that i've misunderstood something about 9-intersection model
@tina sorry, i'm off. i hope you can figure this out. as i said, i think articles papers on 9-intersection and GIS in general can be helpful for current investigation. cheers
user379888
08:10
Anyone knows how to work with graphics.h?
08:24
which graphics.h?
that's just a file name
sbi
sbi
@FredNurk It's the one that appears on the left of a message if you hover your mouse over it.
I'd question a design decision that nobody is able to figure out for 13 hours until the site owner comes and explains it.
0
A: In a comment, markdown inexplicably failed to turn SO URLs into links

Jeff AtwoodBy design. You can no longer mix raw and markdown URLs in the same comment. Pick one way or the other per comment and stick to it.

@sbi ah, thank you
sbi
sbi
08:50
@FredNurk I'll post a new version that has that info in it.
both because I was looking for a more explicit down arrow rather than a triangle after reading that and because the triangle isn't normally visible contributed to me misunderstanding, I believe; if that helps you with the new version
sbi
sbi
Yeah, I'm working on an improved version. It's just hard to cramp everything into a small message.
I wouldn't want to clutter the marked posting area with multiple messages, though.
Anyway, I was surprised you actually saw this. I've never got any feedback for it before.
seems better to just post a link to elsewhere with more comprehensive posting help and tips
sbi
sbi
I thought about that, too. Have an idea where to link to?
no idea
sbi
sbi
09:00
It seems they shortened the max message length. My original message won't fit anymore.
@fahad The only compiler I've dealt with that had a header named "graphics.h" was Borland's compiler for DOS. I don't recall it's being terribly difficult to work with, but it was restricted to MS-DOS. You can't use it in a program that's native to Windows (and I can't quite imagine writing new code for DOS any more).
sbi
sbi
@Jerry Ah, then that's why that header name was irking me...
@sbi: you could post it all as a series of messages here, then create a "conversation" from those and link to that
in the room menu, "create new bookmark"
sbi
sbi
@FredNurk Interesting. I haven't played with conversations yet.
seems cumbersome, but doesn't require any other site
sbi
sbi
09:03
How do I... Nevermind, you just posted it.
Lemme play with it...
Ok, got it working. Now back to that newbie text...
OK, here I come:
You can edit your messages for 2mins. Click the v arrow appearing left of it when you hover your mouse over it.
`cursor up` will edit your last message, `escape` cancels this.
Markdown sort of works here, like in comments, but it fails for multi-line messages. Apparenty, [that's by design](http://meta.stackoverflow.com/questions/70141/markdown-in-chat-fails-for-multi-line-messages/70142#70142).
Dammit, that wasn't supposed to be a multi-line message!
Ok, I have another go at this:
You can edit your messages for 2mins. Click the v arrow appearing left of it when you hover your mouse over it.
cursor up will edit your last message, escape cancels this.
Markdown sort of works here, like in comments, but it fails for multi-line messages. Apparenty, that's by design.
Links to specific web pages (many pages on all of the SE sites, Wikipedia, Twitter,...) will inline an excerpt of the page, when they are the only text in a message.
Reply to others using the familiar @syntax. Reply to specific messages by clicking the v arrow as mentioned above.
You can spend a limited number of stars per day on messages you like. Starred messages are shown on the right. (Room owners can also pin messages to the right.)
If you're new here, read the newbie hints.
@FredNurk You're a star!
 
1 hour later…
10:24
@sbi: welcome, just been exploring the interface and I saw that
10:51
Pos. 1: "Skeet, J: C# IN DEPTH 2/E" [Buch] von Jon Skeet für 36,50 Euro [bestellt: 1, geliefert: 0] - Der Artikel ist noch nicht erschienen, wir haben für Sie vorgemerkt.
:-(
apparently, the book hasn't been published yet. At least it's not available in germany :(
 
2 hours later…
13:00
@FredOverflow For learning just the C# language I found the C# standard (it's an ECMA and ISO standard, ECMA is free) very easy and clear. Because it was written (mainly) by Anders Hejlsberg, the language designer, in the style of an introduction-to-the-language. Possibly with version 4 or whatever C# is up at now, it's not that clear any more, but still, I recommend you try to get hold of it.
sbi
sbi
I found the C# Pocket Reference, co-workers, and SO to be enough. Oh yeah, and the need to write C# for an employer.
13:50
g/m yall
@sbi: hey sbi, you missed some epic grumpiness on my part last night
why are we talking C# in a C++ chat?
Kid
Kid
The accepted answer is excellent here stackoverflow.com/questions/4176328/…
8
A: FAQ : Undefined Behavior and Sequence Points

Johannes Schaub - litbSequence points Sequence points are points in an execution of a program where all side effects produced by evaluations prior to the sequence points have been completed. Side effects produced by evaluations that occur after the sequence point will therefor be separated from side effects produced ...

@Kid: that's an FAQ. we've been trying to put together FAQs in the form of answered questions recently
I agree litb did a good job with that one
Kid
Kid
@JohnDibling I found litb's answer better than the other answers in that page.
14:05
easier to read? more complete?
Kid
Kid
more complete and easier to read.
do you find the FAQs useful/helpful?
Kid
Kid
yes I find it very helpful. Other than the above mentioned faq I tried to read the other faqs 'copy and swap' and 'rule of three' and found them extremely useful. I had a difficult time understanding 'copy and swap' answer but the other two were relatively simpler.
there is some debate on meta about how the faqs should be constructed
Kid
Kid
okay
14:17
@kid: is there something you were looking for but didn't find faq'ed? in other words, what are we missing?
are copy ctors faq'd?
Kid
Kid
On reading the sequence point thread I got everything from proper explanation to quotes from the Standard which I always find useful. Other faqs were also good. Copy and swap faq has got a far too many upvotes.
@tony: indirectly in the rule-of-three faq
Kid
Kid
@JohnDibling : why has 'copy-swap' faq got so many upvotes? Other faq's haven't got so many of them.
@kid: no idea
Kid
Kid
14:28
@JohnDibling which is your favourite faq?
hmm, dont know if i have a favorite
they are all good, but i think a bit scattered & a little disorganized
some consistency & organization would be useful
gotta run, back later
Kid
Kid
i am going too. tadaa!
sbi
sbi
15:27
@JohnDibling You mean where you were insulting others? Or where you were trolling? Didn't miss any of that. :)
@Kid Because it was the first?
@sbi: where i was trolling
feel kinda bad about it, apologized
sbi
sbi
16:11
I was talking of this:
8 hours ago, by John Dibling
I just did to you what you did to the poster, and you called me a troll for it
I thought that was glorious! :)
Can you guys have a look at stackoverflow.com/questions/4214814, please. I spent three comments on that, to little avail. I think it should be closed now.
@John I just realized I didn't properly attribute you up there, so you might miss it. :)
@sbi: saw it :) also, re close: done
sbi
sbi
16:28
It took me a while to decide on a reason to vote to close this one:
0
Q: How many seconds in a month?

Steven ChengHi, This might be a fundamental question, but how does one accurately determine the number of seconds in a month? Is the best way to take the number of seconds in a year and divide this by 12? Thanks in advance Steve

Is that a troll??
I mean, that's a question for a 9 year old, right? Am I missing something?
@sbi You picked the wrong reason to close. It's clearly Too Localized because "This question would only be relevant to ... a specific moment in time" (at least the question in the title is too localized :-P)
sbi
sbi
@James LOL!
hahahah :)
i'm not one to subscribe to "there are no bad questions"
and that's a bad question
but im not sure it should have been closed
@sbi
The best part of that question is that it got 11 answers.
16:38
Maybe somebody should edit it to "How many seconds in a meaningless question?"
sbi
sbi
@JohnDibling I disagree. Next thing people ask is "What is 2x2?"
@JerryCoffin Only one question can be the second meaningless question. The next one would be the third, and so on. :-)
Joking aside, I'd say it should have been closed, simply because it's off-topic -- it involves computation, but has nothing to do with programming.
I was thinking more like "seconds of apple pie", which can be repeated as often as desird and still be seconds... :-)
...or seconds of RAII???
i guess i can go along with the vote to close
I thought we went through that yesterday, and agreed that seconds of Rye were better (though my personal preference is for wine).
sbi
sbi
16:57
Watch out for that feed guy...
0
A: Setting up a FAQ for the C++ tag

sbiIt's now more than three weeks since I posted this question and I though it's time for a recap and to summarize what has become of it. For you to remember, these were my original thoughts on the matter, as I had formulated them in my answer: I believe that Stack Overflow is a great place to ...


« first day (33 days earlier)      last day (5141 days later) »