Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #54504 > unrolled thread
| Started by | jacob navia <jacob@spamsink.net> |
|---|---|
| First post | 2014-12-14 22:16 +0100 |
| Last post | 2014-12-17 04:20 -0800 |
| Articles | 20 on this page of 51 — 16 participants |
Back to article view | Back to comp.lang.c
fseek under IBM MVS jacob navia <jacob@spamsink.net> - 2014-12-14 22:16 +0100
Re: fseek under IBM MVS glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-12-15 01:12 +0000
Re: fseek under IBM MVS jacob navia <jacob@spamsink.net> - 2014-12-15 09:13 +0100
Re: fseek under IBM MVS glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-12-15 09:22 +0000
Re: fseek under IBM MVS Kaz Kylheku <kaz@kylheku.com> - 2014-12-15 16:26 +0000
Re: fseek under IBM MVS raltbos@xs4all.nl (Richard Bos) - 2014-12-17 09:58 +0000
Re: fseek under IBM MVS BartC <bc@freeuk.com> - 2014-12-17 11:29 +0000
Re: fseek under IBM MVS John Bode <jfbode1029@gmail.com> - 2014-12-15 10:35 -0800
Re: fseek under IBM MVS glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-12-15 21:33 +0000
Re: fseek under IBM MVS jacob navia <jacob@spamsink.net> - 2014-12-15 23:45 +0100
Re: fseek under IBM MVS Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-12-15 17:56 -0500
Re: fseek under IBM MVS Kaz Kylheku <kaz@kylheku.com> - 2014-12-15 23:05 +0000
Re: fseek under IBM MVS BartC <bc@freeuk.com> - 2014-12-15 23:19 +0000
Re: fseek under IBM MVS Keith Thompson <kst-u@mib.org> - 2014-12-15 16:36 -0800
Re: fseek under IBM MVS Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-12-15 20:42 -0500
Re: fseek under IBM MVS jacob navia <jacob@spamsink.net> - 2014-12-16 01:00 +0100
Re: fseek under IBM MVS glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-12-16 01:09 +0000
Re: (OT) fseek under IBM MVS Vincenzo Mercuri <nomail@yahoo.it> - 2014-12-16 09:11 +0100
Re: fseek under IBM MVS raltbos@xs4all.nl (Richard Bos) - 2014-12-17 10:06 +0000
Re: fseek under IBM MVS jacob navia <jacob@spamsink.net> - 2014-12-17 11:33 +0100
Re: fseek under IBM MVS John Bode <jfbode1029@gmail.com> - 2014-12-17 08:48 -0800
Re: fseek under IBM MVS raltbos@xs4all.nl (Richard Bos) - 2014-12-17 17:26 +0000
Re: fseek under IBM MVS jacob navia <jacob@spamsink.net> - 2014-12-17 19:46 +0100
Re: fseek under IBM MVS Richard Heathfield <invalid@see.sig.invalid> - 2014-12-17 19:28 +0000
Re: fseek under IBM MVS jacob navia <jacob@spamsink.net> - 2014-12-17 21:38 +0100
Re: fseek under IBM MVS Richard Heathfield <invalid@see.sig.invalid> - 2014-12-17 21:05 +0000
Re: fseek under IBM MVS Ian Collins <ian-news@hotmail.com> - 2014-12-18 11:37 +1300
Re: fseek under IBM MVS John Bode <jfbode1029@gmail.com> - 2014-12-17 12:43 -0800
Re: fseek under IBM MVS fir <profesor.fir@gmail.com> - 2014-12-19 08:35 -0800
Re: fseek under IBM MVS BartC <bc@freeuk.com> - 2014-12-19 16:51 +0000
Re: fseek under IBM MVS Robert Wessel <robertwessel2@yahoo.com> - 2014-12-19 16:36 -0600
Re: fseek under IBM MVS raltbos@xs4all.nl (Richard Bos) - 2014-12-17 10:05 +0000
Re: fseek under IBM MVS Keith Thompson <kst-u@mib.org> - 2014-12-17 09:05 -0800
Re: fseek under IBM MVS raltbos@xs4all.nl (Richard Bos) - 2014-12-17 17:29 +0000
Re: fseek under IBM MVS John Bode <jfbode1029@gmail.com> - 2014-12-17 12:55 -0800
Re: fseek under IBM MVS John Bode <jfbode1029@gmail.com> - 2014-12-17 15:02 -0800
Re: fseek under IBM MVS raltbos@xs4all.nl (Richard Bos) - 2014-12-17 23:37 +0000
Re: fseek under IBM MVS Keith Thompson <kst-u@mib.org> - 2014-12-17 16:11 -0800
Re: fseek under IBM MVS raltbos@xs4all.nl (Richard Bos) - 2014-12-18 12:06 +0000
Re: fseek under IBM MVS James Kuyper <jameskuyper@verizon.net> - 2014-12-18 11:44 -0500
Re: fseek under IBM MVS Keith Thompson <kst-u@mib.org> - 2014-12-18 11:03 -0800
Re: fseek under IBM MVS raltbos@xs4all.nl (Richard Bos) - 2014-12-19 11:31 +0000
Re: fseek under IBM MVS James Kuyper <jameskuyper@verizon.net> - 2014-12-19 08:03 -0500
Re: fseek under IBM MVS Keith Thompson <kst-u@mib.org> - 2014-12-19 08:08 -0800
Re: fseek under IBM MVS James Kuyper <jameskuyper@verizon.net> - 2014-12-19 11:30 -0500
Re: fseek under IBM MVS Keith Thompson <kst-u@mib.org> - 2014-12-17 15:56 -0800
Re: fseek under IBM MVS Ian Collins <ian-news@hotmail.com> - 2014-12-21 21:37 +1300
Re: fseek under IBM MVS glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-12-17 21:59 +0000
Re: fseek under IBM MVS Keith Thompson <kst-u@mib.org> - 2014-12-17 14:33 -0800
Re: fseek under IBM MVS "Charles Richmond" <numerist@aquaporin4.com> - 2014-12-18 16:06 -0600
Re: fseek under IBM MVS Siri Crews <chine.bleu@yahoo.com> - 2014-12-17 04:20 -0800
Page 2 of 3 — ← Prev page 1 [2] 3 Next page →
| From | John Bode <jfbode1029@gmail.com> |
|---|---|
| Date | 2014-12-17 08:48 -0800 |
| Message-ID | <bc37bbdd-2cf6-4d31-b9a8-f14ca612618b@googlegroups.com> |
| In reply to | #54824 |
On Wednesday, December 17, 2014 4:33:20 AM UTC-6, jacob navia wrote: > > I wrote: > > > Nobody is running any > >> software in a PDP-10 except in the simulators run in modern machines by > >> the die-hard hackers. > > > > That made some idiot wake up after some days and write: > > > What's your salary paid on? > > > > Yes, That's very relevant to the discussion here. > Actually, it is; a lot of payroll and banking systems are still running on legacy hardware, or on emulations of legacy hardware, or are in the process of porting from legacy hardware. I doubt there are any PDP-10s still in service, but it wouldn't surprise me to see a few HP3000s kicking around, even though they were EOL'd back in 2002 or so.
[toc] | [prev] | [next] | [standalone]
| From | raltbos@xs4all.nl (Richard Bos) |
|---|---|
| Date | 2014-12-17 17:26 +0000 |
| Message-ID | <5491bc8f.3549312@news.xs4all.nl> |
| In reply to | #54859 |
John Bode <jfbode1029@gmail.com> wrote: > On Wednesday, December 17, 2014 4:33:20 AM UTC-6, jacob navia wrote: > > > What's your salary paid on? > > > > Yes, That's very relevant to the discussion here. > > Actually, it is; a lot of payroll and banking systems are still running > on legacy hardware, or on emulations of legacy hardware, or are in the > process of porting from legacy hardware. I doubt there are any PDP-10s > still in service, but it wouldn't surprise me to see a few HP3000s kicking > around, even though they were EOL'd back in 2002 or so. Yup, but they're not jacob's state-of-the-art, top-of-the-line desktop development machine, so they don't count as "computers in use by anybody". Richard
[toc] | [prev] | [next] | [standalone]
| From | jacob navia <jacob@spamsink.net> |
|---|---|
| Date | 2014-12-17 19:46 +0100 |
| Message-ID | <m6sj18$5m3$1@speranza.aioe.org> |
| In reply to | #54859 |
Le 17/12/2014 17:48, John Bode a écrit : > On Wednesday, December 17, 2014 4:33:20 AM UTC-6, jacob navia wrote: >>> I wrote: >>> >> Nobody is running any >>>> software in a PDP-10 except in the simulators run in modern machines by >>>> the die-hard hackers. >>> >> >> That made some idiot wake up after some days and write: >> >>> What's your salary paid on? >>> >> >> Yes, That's very relevant to the discussion here. >> > > Actually, it is; a lot of payroll and banking systems are still running > on legacy hardware, or on emulations of legacy hardware, or are in the > process of porting from legacy hardware. I doubt there are any PDP-10s > still in service, but it wouldn't surprise me to see a few HP3000s kicking > around, even though they were EOL'd back in 2002 or so. > So, you agree with the insults of course and participate to this internet bulling He said (and you left that out) <quote> Oh, wait, you don't have a salary, you make your money selling other people's work... <end quote> You did not read THAT of course. How funny is to participate to internet bulling. Gathering together to make fun of a single individual that dares opposing the prevailing groupthink. Without having the looks of doing anything wrong, just like heathfield, kiki, and all the others here.
[toc] | [prev] | [next] | [standalone]
| From | Richard Heathfield <invalid@see.sig.invalid> |
|---|---|
| Date | 2014-12-17 19:28 +0000 |
| Message-ID | <KPkkw.120694$dG.76818@fx32.am4> |
| In reply to | #54874 |
jacob navia wrote: > Le 17/12/2014 17:48, John Bode a écrit : >> On Wednesday, December 17, 2014 4:33:20 AM UTC-6, jacob navia wrote: >>>> I wrote: >>>> >>> Nobody is running any >>>>> software in a PDP-10 except in the simulators run in modern machines >>>>> by the die-hard hackers. >>>> >>> >>> That made some idiot wake up after some days and write: >>> >>>> What's your salary paid on? >>>> >>> >>> Yes, That's very relevant to the discussion here. >>> >> >> Actually, it is; a lot of payroll and banking systems are still running >> on legacy hardware, or on emulations of legacy hardware, or are in the >> process of porting from legacy hardware. I doubt there are any PDP-10s >> still in service, but it wouldn't surprise me to see a few HP3000s >> kicking around, even though they were EOL'd back in 2002 or so. >> > > So, you agree with the insults of course and participate to this > internet bulling You are extending his position. His claim is not about insults, but about the continued use of big iron within the IT world. And he is quite right. > > He said (and you left that out) > > <quote> > Oh, wait, you don't have a salary, you make your money selling other > people's work... > <end quote> > > You did not read THAT of course. How funny is to participate to internet > bulling. He didn't participate in it. He simply refrained from commenting on it. Why he did that, I don't know. But it may simply be because it is not relevant to the discussion, which is about the fseek/ftell hack for finding a file size (and it /is/ a hack, in the pejorative sense of the word) not working on some systems. > > Gathering together to make fun of a single individual that dares > opposing the prevailing groupthink. I'm not interested in making fun of you. Nor am I interested in "the prevailing groupthink". I am, of course, interested in technical discussions about the C language. And I am curious as to why you are so antipathetic towards systems that work in a way you're not used to, and for which C (rightly, in my view) makes provision. You would have a point *if* the C Standard sanctioned the use of fseek and ftell to determine a file's size. But it doesn't. That was never more than a hack. The right way to get the file's size is to ask the OS. Since this is not portable, those who care about portability will wrap up the call in a function of their own. Sometimes one must just accept that there are some things that cannot be done 100% portably, but there are steps that one can take to mitigate this problem, so the situation isn't hopeless by any means. And, of course, if you insist on using the ftell/fseek hack but you are absolutely sure that your code will never have to work on a system where the hack doesn't work, then you don't have a problem. So why worry? > > Without having the looks of doing anything wrong, just like heathfield, > kiki, and all the others here. That statement does you no credit. -- Richard Heathfield Email: rjh at cpax dot org dot uk "Usenet is a strange place" - dmr 29 July 1999 Sig line 4 vacant - apply within
[toc] | [prev] | [next] | [standalone]
| From | jacob navia <jacob@spamsink.net> |
|---|---|
| Date | 2014-12-17 21:38 +0100 |
| Message-ID | <m6spjb$pm5$1@speranza.aioe.org> |
| In reply to | #54875 |
In all his tirade heathfield never mentions the insults of mr boss. Mr heathfield participates to the bulling with distinction. He always sides with those insulting, never critizing mr bos or indicating that insults aren't really a way of discussing. But with a tone as he would be impartial, just calmly examining the facts. But he will never acknowledge that insulting me is somehow wrong, or maybe nasty, of course not, that's the approved sport in this group. Nor he sanctions the same attitude in the others that implicitely do the same like mr bode. Of course not. We are calmly discussing fseek/ftell and if mr bos says that I am selling "the work of others" or whatever nonsense he throws at me, he will be NEVER receive a critical remark from anyone here. I can be insulted because I dare to repeat that the PDP 10 that Mr bode brought as an example of a system where fseek/ftell do not work disappeared more than 30 years ago. Saying such a truth allows Bos to start insulting me, and then another will bring his killfile and say why I am on it, etc etc. Always the same since at least 10 years!
[toc] | [prev] | [next] | [standalone]
| From | Richard Heathfield <invalid@see.sig.invalid> |
|---|---|
| Date | 2014-12-17 21:05 +0000 |
| Message-ID | <Cemkw.95926$Uc3.47255@fx33.am4> |
| In reply to | #54878 |
jacob navia wrote: > In all his tirade heathfield never mentions the insults of mr boss. Does Richard Bos insult you? Yes, sometimes. Do you insult Richard Bos? Yes, sometimes. All you have to do is stop. If he doesn't stop, you win. If he does stop, you both win. If you both spend that energy discussing C instead, we all win. > Mr heathfield participates to the bulling with distinction. I disagree, but you are entitled to your opinion. > > He always sides with those insulting, never critizing mr bos or > indicating that insults aren't really a way of discussing. But with a > tone as he would be impartial, just calmly examining the facts. Insults do not contribute to the discussion, but neither do they contribute to the reputation of the person doing the insulting. If you want to improve your credibility here, one great way to start would be to stop getting personally involved and get on with dispassionately discussing C. > But he will never acknowledge that insulting me is somehow wrong, or > maybe nasty, of course not, that's the approved sport in this group. Actually, the approved sport in this group is discussing C. Insults waste everybody's time. > > Nor he sanctions the same attitude in the others that implicitely do the > same like mr bode. Mr Bode made a technical comment. It would have been a good idea to base your response on technical grounds. It's not too late to do that, thanks to the threaded nature of Usenet. > > Of course not. We are calmly discussing fseek/ftell and if mr bos says > that I am selling "the work of others" or whatever nonsense he throws at > me, he will be NEVER receive a critical remark from anyone here. What's the point? He's not going to change because people tell him to. True change comes from within. And I suppose it's pretty pointless trying to get you to change your behaviour, too. But, in the interests of fair play, Mr Bos, consider yourself criticised. (Not that he will see that comment, since he killfiled me a few years ago.) And the thing is, some of us /are/ calmly discussing fseek/ftell. Join us! > > I can be insulted because I dare to repeat that the PDP 10 that Mr bode > brought as an example of a system where fseek/ftell do not work > disappeared more than 30 years ago. People don't need a reason to insult you, me, or anyone else. Either they are the kind of people who hurl insults around or they aren't. Some of us prefer to get on with technical discussions. > Saying such a truth allows Bos to start insulting me, and then another > will bring his killfile and say why I am on it, etc etc. It isn't a question of allowing him. In unmoderated groups such as this one, there is no way to /dis/allow him. Or you. If you want to shout at each other till you're blue in the face, there's nothing anyone can do to stop you. Or, of course, you could spend that energy and time discussing C instead. > Always the same since at least 10 years! Don't rise to it. If you stick to technical discussions, anyone insulting you will be left high and dry and looking very foolish. But if you continue to react as you do, there will always be those who poke you to see how you squeal. Don't let them win. Grow a thicker skin. -- Richard Heathfield Email: rjh at cpax dot org dot uk "Usenet is a strange place" - dmr 29 July 1999 Sig line 4 vacant - apply within
[toc] | [prev] | [next] | [standalone]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Date | 2014-12-18 11:37 +1300 |
| Message-ID | <cfeetkFdudlU15@mid.individual.net> |
| In reply to | #54878 |
jacob navia wrote: > In all his tirade heathfield never mentions the insults of mr boss. Those are tiresome and best ignored. > Mr heathfield participates to the bulling with distinction. You jest? I've never seen Richard Heathfield bully anyone in this group. The best way to deal with tolling or bullying on Usenet is to ignore it. Reacting only perpetuates the cycle. > Of course not. We are calmly discussing fseek/ftell and if mr bos says > that I am selling "the work of others" or whatever nonsense he throws at > me, he will be NEVER receive a critical remark from anyone here. Well he has from me, for all the good it did. Use a kill-file and/or grow a thicker skin. -- Ian Collins
[toc] | [prev] | [next] | [standalone]
| From | John Bode <jfbode1029@gmail.com> |
|---|---|
| Date | 2014-12-17 12:43 -0800 |
| Message-ID | <23d3f06e-f665-415b-9a70-e0b0a131d1d6@googlegroups.com> |
| In reply to | #54874 |
On Wednesday, December 17, 2014 12:46:18 PM UTC-6, jacob navia wrote: > Le 17/12/2014 17:48, John Bode a écrit : > > On Wednesday, December 17, 2014 4:33:20 AM UTC-6, jacob navia wrote: > >>> I wrote: > >>> > >> Nobody is running any > >>>> software in a PDP-10 except in the simulators run in modern machines by > >>>> the die-hard hackers. > >>> > >> > >> That made some idiot wake up after some days and write: > >> > >>> What's your salary paid on? > >>> > >> > >> Yes, That's very relevant to the discussion here. > >> > > > > Actually, it is; a lot of payroll and banking systems are still running > > on legacy hardware, or on emulations of legacy hardware, or are in the > > process of porting from legacy hardware. I doubt there are any PDP-10s > > still in service, but it wouldn't surprise me to see a few HP3000s kicking > > around, even though they were EOL'd back in 2002 or so. > > > > So, you agree with the insults of course and participate to this > internet bulling > Dammit Jacob, this is tiresome. You *always* assume other people are attacking you personally, even when they're not (*especially* when they're not). I participate in, what, a dozen or so threads over the course of a year, yet somehow always manage to stumble into one where you're *aggrieved* by something someone said or didn't say or did or didn't do. > He said (and you left that out) I left it out because I felt no desire to participate in personal attacks on you or anyone else. I left it out because it had no bearing on the technical side of the discussion, which is all that really matters. I didn't agree with the attacks or the tone, but didn't think they merited comment. I didn't quote them because they didn't deserve to be repeated. I'm not going to quote them here, either, because I still don't think they deserve to be repeated. I'm not going to jump to your defense when someone gets snarky with you (unless it's something *really* egregious); that doesn't mean I *agree* with them. It just means I don't care that much.
[toc] | [prev] | [next] | [standalone]
| From | fir <profesor.fir@gmail.com> |
|---|---|
| Date | 2014-12-19 08:35 -0800 |
| Message-ID | <4c8e96a9-2c41-4941-bfc9-38c30f77138c@googlegroups.com> |
| In reply to | #54615 |
W dniu poniedziałek, 15 grudnia 2014 23:45:29 UTC+1 użytkownik jacob navia napisał: > Le 15/12/2014 22:33, glen herrmannsfeldt a écrit : > > On the PDP-10 systems files are specified in the number > > of 36 bit words that they contain. To complicate C, text files > > are stored with five 7-bit ASCII characters per word. In core, > > C stores four 9 bit characters per word. > > Great! > > You forgot to tell us a little detail: > > The PDP-10 line started in 1968 (45 YEARS AGO!) and was closed in 1983, > 31 YEARS AGO! > > ALL this crap is completely useless today. Nobody is running any > software in a PDP-10 except in the simulators run in modern machines by > the die-hard hackers. wasnt the PDP-10 the machine where c was born? (i dont remember maybe that was PDP-11 meaning not much for me as i dont know it, I am a C64 child) Anyway if so this machine needs important respact
[toc] | [prev] | [next] | [standalone]
| From | BartC <bc@freeuk.com> |
|---|---|
| Date | 2014-12-19 16:51 +0000 |
| Message-ID | <1IYkw.123299$W43.42073@fx04.am4> |
| In reply to | #55081 |
On 19/12/2014 16:35, fir wrote: > W dniu poniedziałek, 15 grudnia 2014 23:45:29 UTC+1 użytkownik jacob navia napisał: >> Le 15/12/2014 22:33, glen herrmannsfeldt a écrit : >>> On the PDP-10 systems files are specified in the number >>> of 36 bit words that they contain. To complicate C, text files >>> are stored with five 7-bit ASCII characters per word. In core, >>> C stores four 9 bit characters per word. >> >> Great! >> >> You forgot to tell us a little detail: >> >> The PDP-10 line started in 1968 (45 YEARS AGO!) and was closed in 1983, >> 31 YEARS AGO! >> >> ALL this crap is completely useless today. Nobody is running any >> software in a PDP-10 except in the simulators run in modern machines by >> the die-hard hackers. > > wasnt the PDP-10 the machine where c was born? (i dont remember maybe that was PDP-11 meaning not much for me as i dont know it, I am a C64 child) > > Anyway if so this machine needs important respact The pdp10 was a very nice machine but I don't think it had much to do with the creation of C. (I have fond memories of it as it was the first computer I programmed. Even though you could only use it, at first, by booking a one-hour session with a paper teletype running at 10 characters-per-second.) -- Bartc
[toc] | [prev] | [next] | [standalone]
| From | Robert Wessel <robertwessel2@yahoo.com> |
|---|---|
| Date | 2014-12-19 16:36 -0600 |
| Message-ID | <sp999a5m3ipakob5r2b00c951bh27sgg4v@4ax.com> |
| In reply to | #55081 |
On Fri, 19 Dec 2014 08:35:16 -0800 (PST), fir <profesor.fir@gmail.com> wrote: >W dniu poniedzia?ek, 15 grudnia 2014 23:45:29 UTC+1 u?ytkownik jacob navia napisa?: >> Le 15/12/2014 22:33, glen herrmannsfeldt a écrit : >> > On the PDP-10 systems files are specified in the number >> > of 36 bit words that they contain. To complicate C, text files >> > are stored with five 7-bit ASCII characters per word. In core, >> > C stores four 9 bit characters per word. >> >> Great! >> >> You forgot to tell us a little detail: >> >> The PDP-10 line started in 1968 (45 YEARS AGO!) and was closed in 1983, >> 31 YEARS AGO! >> >> ALL this crap is completely useless today. Nobody is running any >> software in a PDP-10 except in the simulators run in modern machines by >> the die-hard hackers. > >wasnt the PDP-10 the machine where c was born? (i dont remember maybe that was PDP-11 meaning not much for me as i dont know it, I am a C64 child) > >Anyway if so this machine needs important respact Unix was originally developed in assembler on the PDP-7. C was developed to allow the rewrite/port to the PDP-11. The -10's were very different machines, 36 bit words, and an evolution of the PDP-6. The PDP-11 were more-or-less replaced by the VAXen.
[toc] | [prev] | [next] | [standalone]
| From | raltbos@xs4all.nl (Richard Bos) |
|---|---|
| Date | 2014-12-17 10:05 +0000 |
| Message-ID | <549153d8.2327046@news.xs4all.nl> |
| In reply to | #54581 |
John Bode <jfbode1029@gmail.com> wrote: > I still say that file size is a function of the file system, so you should > use system-specific functions (stat() or fstat() on POSIX systems, for > example) to query the filesystem directly, rather than using the > fseek/ftell idiom. Apart from the reliability issue, the fseek()/ftell() trick simply is inefficient, in a way that fstat()/filelength()/GetFileSize()/&c. aren't, if they're at all well implemented. Richard
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2014-12-17 09:05 -0800 |
| Message-ID | <lnvbladx5k.fsf@nuthaus.mib.org> |
| In reply to | #54818 |
raltbos@xs4all.nl (Richard Bos) writes:
> John Bode <jfbode1029@gmail.com> wrote:
>> I still say that file size is a function of the file system, so you should
>> use system-specific functions (stat() or fstat() on POSIX systems, for
>> example) to query the filesystem directly, rather than using the
>> fseek/ftell idiom.
>
> Apart from the reliability issue, the fseek()/ftell() trick simply is
> inefficient, in a way that fstat()/filelength()/GetFileSize()/&c.
> aren't, if they're at all well implemented.
On a system where it works, I woudnl't expect the fseek()/ftell() trick
to be particularly inefficient.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | raltbos@xs4all.nl (Richard Bos) |
|---|---|
| Date | 2014-12-17 17:29 +0000 |
| Message-ID | <5491bce4.3633812@news.xs4all.nl> |
| In reply to | #54865 |
Keith Thompson <kst-u@mib.org> wrote: > raltbos@xs4all.nl (Richard Bos) writes: > > John Bode <jfbode1029@gmail.com> wrote: > >> I still say that file size is a function of the file system, so you should > >> use system-specific functions (stat() or fstat() on POSIX systems, for > >> example) to query the filesystem directly, rather than using the > >> fseek/ftell idiom. > > > > Apart from the reliability issue, the fseek()/ftell() trick simply is > > inefficient, in a way that fstat()/filelength()/GetFileSize()/&c. > > aren't, if they're at all well implemented. > > On a system where it works, I woudnl't expect the fseek()/ftell() trick > to be particularly inefficient. Not particularly, and not if used once a second by a single user on a desktop system. But I'd still expect the system-specific functions to be more efficient, maybe even noticably so (even if not by much) on, say, a file server serving thousands of users at a time. Richard
[toc] | [prev] | [next] | [standalone]
| From | John Bode <jfbode1029@gmail.com> |
|---|---|
| Date | 2014-12-17 12:55 -0800 |
| Message-ID | <5335081f-da7f-45f8-9e3f-846071ad8a22@googlegroups.com> |
| In reply to | #54871 |
On Wednesday, December 17, 2014 11:29:22 AM UTC-6, Richard Bos wrote: > Keith Thompson <kst-u@mib.org> wrote: > > > raltbos@xs4all.nl (Richard Bos) writes: > > > John Bode <jfbode1029@gmail.com> wrote: > > >> I still say that file size is a function of the file system, so you should > > >> use system-specific functions (stat() or fstat() on POSIX systems, for > > >> example) to query the filesystem directly, rather than using the > > >> fseek/ftell idiom. > > > > > > Apart from the reliability issue, the fseek()/ftell() trick simply is > > > inefficient, in a way that fstat()/filelength()/GetFileSize()/&c. > > > aren't, if they're at all well implemented. > > > > On a system where it works, I woudnl't expect the fseek()/ftell() trick > > to be particularly inefficient. > > Not particularly, and not if used once a second by a single user on a > desktop system. But I'd still expect the system-specific functions to be > more efficient, maybe even noticably so (even if not by much) on, say, a > file server serving thousands of users at a time. > > Richard I *assume* stat() and fstat() simply query the inode, which I also assume would be faster than traversing block pointers to the last block in the file. But, that's an assumption; I haven't systematically measured it. Going to do that now. Have some hellaciously big log files that I can use to test against.
[toc] | [prev] | [next] | [standalone]
| From | John Bode <jfbode1029@gmail.com> |
|---|---|
| Date | 2014-12-17 15:02 -0800 |
| Message-ID | <f04dfd77-aa90-4604-bd6b-c81fc3861e05@googlegroups.com> |
| In reply to | #54880 |
On Wednesday, December 17, 2014 2:55:59 PM UTC-6, John Bode wrote: > On Wednesday, December 17, 2014 11:29:22 AM UTC-6, Richard Bos wrote: > > Keith Thompson <kst-u@mib.org> wrote: > > > > > raltbos@xs4all.nl (Richard Bos) writes: > > > > John Bode <jfbode1029@gmail.com> wrote: > > > >> I still say that file size is a function of the file system, so you should > > > >> use system-specific functions (stat() or fstat() on POSIX systems, for > > > >> example) to query the filesystem directly, rather than using the > > > >> fseek/ftell idiom. > > > > > > > > Apart from the reliability issue, the fseek()/ftell() trick simply is > > > > inefficient, in a way that fstat()/filelength()/GetFileSize()/&c. > > > > aren't, if they're at all well implemented. > > > > > > On a system where it works, I woudnl't expect the fseek()/ftell() trick > > > to be particularly inefficient. > > > > Not particularly, and not if used once a second by a single user on a > > desktop system. But I'd still expect the system-specific functions to be > > more efficient, maybe even noticably so (even if not by much) on, say, a > > file server serving thousands of users at a time. > > > > Richard > > I *assume* stat() and fstat() simply query the inode, which I also assume > would be faster than traversing block pointers to the last block in the > file. But, that's an assumption; I haven't systematically measured it. > > Going to do that now. Have some hellaciously big log files that I can > use to test against. Womped up a quick and very dirty test on a 64-bit SLES 10 system. Wrote 3 functions to get file size; one calls stat on the pathname, one opens the file and calls fstat on the descriptor, and the third opens the file and uses fseek/ftell on the file pointer. The functions that use stat and fstat take around 3 to 4 usec to run. The function that uses fseek/ftell takes 15 to 20 usec. The sizes all report the same (one would hope). Of course, whether the performance difference means anything depends on the context. If you're doing this for one file once over the lifetime of the program, it really doesn't matter. If you're doing this thousands of times for an entire filesystem, then stat would probably be the better choice. I'd favor stat since it doesn't require an open file descriptor/pointer. But if you already have an open file (via fopen), then fseek/ftell is probably the path of least resistance. And to be honest, if you're working on a filesystem where fseek/ftell don't give you a correct file size, you're probably already well aware of that fact and are using a different method anyway.
[toc] | [prev] | [next] | [standalone]
| From | raltbos@xs4all.nl (Richard Bos) |
|---|---|
| Date | 2014-12-17 23:37 +0000 |
| Message-ID | <549212fb.25673218@news.xs4all.nl> |
| In reply to | #54890 |
John Bode <jfbode1029@gmail.com> wrote: > Wrote 3 functions to get file size; one calls stat on the pathname, one > opens the file and calls fstat on the descriptor, and the third opens the > file and uses fseek/ftell on the file pointer. > > The functions that use stat and fstat take around 3 to 4 usec to run. The > function that uses fseek/ftell takes 15 to 20 usec. That's actually a larger difference than I expected. > Of course, whether the performance difference means anything depends on > the context. Certainly. > And to be honest, if you're working on a filesystem where fseek/ftell don't > give you a correct file size, you're probably already well aware of that > fact and are using a different method anyway. My problem is simply with depending on the wrong method when there is a better one already available. It's similar to why I don't understand why anyone would use strcpy() when they can do the same thing better, more efficiently, and usually more reliably, with strcat(): even if the difference is marginal, the cost is zero. Richard
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2014-12-17 16:11 -0800 |
| Message-ID | <ln1tnxes0a.fsf@nuthaus.mib.org> |
| In reply to | #54895 |
raltbos@xs4all.nl (Richard Bos) writes:
[...]
> My problem is simply with depending on the wrong method when there is a
> better one already available. It's similar to why I don't understand why
> anyone would use strcpy() when they can do the same thing better, more
> efficiently, and usually more reliably, with strcat(): even if the
> difference is marginal, the cost is zero.
How is strcat() an improvement over strcpy()? strcpy() works with an
uninitialized target array. strcat() doesn't, and in cases where the
target doesn't already contain an empty string it behaves differently.
Do you have an example?
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | raltbos@xs4all.nl (Richard Bos) |
|---|---|
| Date | 2014-12-18 12:06 +0000 |
| Message-ID | <5492c2fc.401187@news.xs4all.nl> |
| In reply to | #54902 |
Keith Thompson <kst-u@mib.org> wrote: > raltbos@xs4all.nl (Richard Bos) writes: > [...] > > My problem is simply with depending on the wrong method when there is a > > better one already available. It's similar to why I don't understand why > > anyone would use strcpy() when they can do the same thing better, more > > efficiently, and usually more reliably, with strcat(): even if the > > difference is marginal, the cost is zero. > > How is strcat() an improvement over strcpy()? Sorry, typo/braino. I meant strncpy() and strncat(). Richard
[toc] | [prev] | [next] | [standalone]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Date | 2014-12-18 11:44 -0500 |
| Message-ID | <54930469.3010102@verizon.net> |
| In reply to | #54931 |
On 12/18/2014 07:06 AM, Richard Bos wrote: > Keith Thompson <kst-u@mib.org> wrote: > >> raltbos@xs4all.nl (Richard Bos) writes: >> [...] >>> My problem is simply with depending on the wrong method when there is a >>> better one already available. It's similar to why I don't understand why >>> anyone would use strcpy() when they can do the same thing better, more >>> efficiently, and usually more reliably, with strcat(): even if the >>> difference is marginal, the cost is zero. >> >> How is strcat() an improvement over strcpy()? > > Sorry, typo/braino. I meant strncpy() and strncat(). That makes more sense, though my own preferences differ. In most contexts in my code where I might need either one or the other of those, I already know the starting place for inserting new characters, and I need the unused portion of the array to be nulled out. Every appearance of strncat() in code that I am currently responsible for was due to it being originally written by someone else.
[toc] | [prev] | [next] | [standalone]
Page 2 of 3 — ← Prev page 1 [2] 3 Next page →
Back to top | Article view | comp.lang.c
csiph-web