Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #17583 > unrolled thread
| Started by | Lord Voldermort <nospam@nospam.com> |
|---|---|
| First post | 2012-02-18 22:18 +0000 |
| Last post | 2012-03-01 05:57 -0500 |
| Articles | 20 on this page of 23 — 12 participants |
Back to article view | Back to comp.lang.c
Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets? Lord Voldermort <nospam@nospam.com> - 2012-02-18 22:18 +0000
Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets? Lord Voldermort <nospam@nospam.com> - 2012-02-18 22:36 +0000
Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-02-18 22:55 +0000
Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets? Kaz Kylheku <kaz@kylheku.com> - 2012-02-19 06:05 +0000
Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets? Keith Thompson <kst-u@mib.org> - 2012-02-18 15:01 -0800
Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets? Lord Voldermort <nospam@nospam.com> - 2012-02-19 10:54 +0000
Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-02-19 12:21 +0000
Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets? Lord Voldermort <nospam@nospam.com> - 2012-02-19 19:53 +0000
Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets? Keith Thompson <kst-u@mib.org> - 2012-02-19 12:15 -0800
Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets? Geoff <geoff@invalid.invalid> - 2012-02-19 13:58 -0800
Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets? Stephen Sprunk <stephen@sprunk.org> - 2012-02-19 17:19 -0600
Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets? James Kuyper <jameskuyper@verizon.net> - 2012-02-19 18:41 -0500
Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets? Robert Wessel <robertwessel2@yahoo.com> - 2012-02-20 01:51 -0600
Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets? Keith Thompson <kst-u@mib.org> - 2012-02-20 02:19 -0800
Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets? Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-02-20 00:45 -0800
Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets? Nick Keighley <nick_keighley_nospam@hotmail.com> - 2012-02-20 00:52 -0800
Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-02-20 13:25 +0000
Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets? Keith Thompson <kst-u@mib.org> - 2012-02-20 10:33 -0800
Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets? Quentin Pope <qp19433@hotmail.NOSPAM.com> - 2012-02-21 19:51 +0000
Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets? James Kuyper <jameskuyper@verizon.net> - 2012-02-21 15:11 -0500
Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets? Jens Gustedt <jens.gustedt@loria.fr> - 2012-02-22 08:35 +0100
Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets? Keith Thompson <kst-u@mib.org> - 2012-02-22 02:18 -0800
Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets? David Thompson <dave.thompson2@verizon.net> - 2012-03-01 05:57 -0500
Page 1 of 2 [1] 2 Next page →
| From | Lord Voldermort <nospam@nospam.com> |
|---|---|
| Date | 2012-02-18 22:18 +0000 |
| Subject | Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets? |
| Message-ID | <jhp83t$3un$1@speranza.aioe.org> |
As per subject. Thanks. Tom R.
[toc] | [next] | [standalone]
| From | Lord Voldermort <nospam@nospam.com> |
|---|---|
| Date | 2012-02-18 22:36 +0000 |
| Message-ID | <jhp94s$7c4$1@speranza.aioe.org> |
| In reply to | #17583 |
Lord Voldermort writes: > As per subject. > > Thanks. > > Tom R. *BUMP* Anyone able to answer this q?
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2012-02-18 22:55 +0000 |
| Message-ID | <0.598e876e0929d611c5da.20120218225555GMT.87fwe7hhtw.fsf@bsb.me.uk> |
| In reply to | #17584 |
Lord Voldermort <nospam@nospam.com> writes: > Lord Voldermort writes: >> As per subject. >> >> Thanks. >> >> Tom R. > > *BUMP* > > Anyone able to answer this q? I'd have a go if I knew what you meant by "disabled". By the way, 18 minutes is not a long time on Usenet, and "bumping" a thread usually just annoys people. -- Ben.
[toc] | [prev] | [next] | [standalone]
| From | Kaz Kylheku <kaz@kylheku.com> |
|---|---|
| Date | 2012-02-19 06:05 +0000 |
| Message-ID | <20120218220512.227@kylheku.com> |
| In reply to | #17584 |
On 2012-02-18, Lord Voldermort <nospam@nospam.com> wrote: > Lord Voldermort writes: >> As per subject. >> >> Thanks. >> >> Tom R. > > *BUMP* Don't do this; Usenet is not a web bulletin board.
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2012-02-18 15:01 -0800 |
| Message-ID | <lnobsveofu.fsf@nuthaus.mib.org> |
| In reply to | #17583 |
Lord Voldermort <nospam@nospam.com> writes:
> As per subject.
>
> Thanks.
>
> Tom R.
This is Usenet, not a web form or chat room. I suggest reading
some of the other articles posted here to get a feeling for the
best style.
Please put your question in the body of the post, not just in
the title.
Posting again after 18 minutes to "bump" the original post is not
useful. If you don't get a response after a day or so, it *might*
be time to worry.
Your actual questions, copied from the title:
> Has Implicit Int been disabled in the new C11 standard?
Implicit int was removed from the language by the C99 standard.
(C11 did not restore it.) Many, probably most, C compilers still
support it as an extension (or just because they don't yet conform
to C99).
> What about other previously depreciated constructions eg gets?
The gets function was removed completely.
I'm not aware of any other deprecated (note spelling) features that were
removed by C11. In particular, old-style function declarations and
definitions are still in the language.
You can get a draft, nearly equivalent to the final C11 standard, at
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf>.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Will write code for food.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | Lord Voldermort <nospam@nospam.com> |
|---|---|
| Date | 2012-02-19 10:54 +0000 |
| Message-ID | <jhqkco$g1$1@speranza.aioe.org> |
| In reply to | #17586 |
Keith Thompson writes: > Lord Voldermort <nospam@nospam.com> writes: >> As per subject. >> >> Thanks. >> >> Tom R. > > This is Usenet, not a web form or chat room. I suggest reading some of > the other articles posted here to get a feeling for the best style. > > Please put your question in the body of the post, not just in the title. > > Posting again after 18 minutes to "bump" the original post is not > useful. If you don't get a response after a day or so, it *might* be > time to worry. > > Your actual questions, copied from the title: > >> Has Implicit Int been disabled in the new C11 standard? > > Implicit int was removed from the language by the C99 standard. (C11 did > not restore it.) Many, probably most, C compilers still support it as > an extension (or just because they don't yet conform to C99). > >> What about other previously depreciated constructions eg gets? > > The gets function was removed completely. > > I'm not aware of any other deprecated (note spelling) features that were > removed by C11. In particular, old-style function declarations and > definitions are still in the language. > > You can get a draft, nearly equivalent to the final C11 standard, at > <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf>. Thx for the info Keiht, sorry about breech of protocol - didnt see a way to tell how many ppl are in this room so didnt know whether it was empty or ppl just missed my post. So is there any translation program then to take code for the previous standard and upgrade it to work with C11 (replace gets by fgets etc)?
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2012-02-19 12:21 +0000 |
| Message-ID | <0.2067cba4440d7d3b9d58.20120219122155GMT.87ty2nf1y4.fsf@bsb.me.uk> |
| In reply to | #17602 |
Lord Voldermort <nospam@nospam.com> writes: <snip> > Thx for the info Keiht, sorry about breech of protocol - didnt see a way > to tell how many ppl are in this room so didnt know whether it was empty > or ppl just missed my post. Have a read of this: http://en.wikipedia.org/wiki/Usenet to get an overview. > So is there any translation program then to take code for the previous > standard and upgrade it to work with C11 (replace gets by fgets etc)? In a way, yes. Your compiler can help if you if you ask for conformance to a specific standard. That is likely to flag up problems, but it won't fix them, of course. Some, like calls to gets, can't be fixed automatically because the problem is that the function just does not have enough information to do a safe job. Each call needs to be looked at by someone who understands the code. If the code is very old (pre-C90, often called K&R C) you'd have to have a good reason to update it because the move to prototypes alters the way a function is called in subtle ways. If in doubt, ask about that specifically. -- Ben.
[toc] | [prev] | [next] | [standalone]
| From | Lord Voldermort <nospam@nospam.com> |
|---|---|
| Date | 2012-02-19 19:53 +0000 |
| Message-ID | <jhrk06$h7r$1@speranza.aioe.org> |
| In reply to | #17603 |
Ben Bacarisse writes: > Lord Voldermort <nospam@nospam.com> writes: <snip> > >> Thx for the info Keiht, sorry about breech of protocol - didnt see a >> way to tell how many ppl are in this room so didnt know whether it was >> empty or ppl just missed my post. > > Have a read of this: http://en.wikipedia.org/wiki/Usenet to get an > overview. Didnt have time to read all that, but just flicking through I didnt see anything about listing other people currently in this room/browsing the forum/whatever you want to call it. >> So is there any translation program then to take code for the previous >> standard and upgrade it to work with C11 (replace gets by fgets etc)? > > In a way, yes. Your compiler can help if you if you ask for conformance > to a specific standard. That is likely to flag up problems, but it > won't fix them, of course. Some, like calls to gets, can't be fixed > automatically because the problem is that the function just does not > have enough information to do a safe job. Each call needs to be looked > at by someone who understands the code. > > If the code is very old (pre-C90, often called K&R C) you'd have to have > a good reason to update it because the move to prototypes alters the way > a function is called in subtle ways. If in doubt, ask about that > specifically. Are you sure about this? Industry best practise is -- if possible, be backwards compatable; if that can't be done, provide an automatic updater. This has always been the case eg with Visual Basic. It seems quite wreckless to update C while breaking existing programs and leaving people to re-code manually!
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2012-02-19 12:15 -0800 |
| Message-ID | <lnk43ieg07.fsf@nuthaus.mib.org> |
| In reply to | #17617 |
Lord Voldermort <nospam@nospam.com> writes:
> Ben Bacarisse writes:
>> Lord Voldermort <nospam@nospam.com> writes: <snip>
>>> Thx for the info Keiht, sorry about breech of protocol - didnt see a
>>> way to tell how many ppl are in this room so didnt know whether it was
>>> empty or ppl just missed my post.
>>
>> Have a read of this: http://en.wikipedia.org/wiki/Usenet to get an
>> overview.
>
> Didnt have time to read all that, but just flicking through I didnt see
> anything about listing other people currently in this room/browsing the
> forum/whatever you want to call it.
There is no such feature. Don't think of this as a "room". A closer
metaphor might be distributed broadcast e-mail that anyone can read and
write.
I read your article on my own computer; there is no central server
that would know that. Your article was downloaded by the news
server I use (which happens to be news.eternal-september.org), but
that's just one of a number of news servers that share information
with each other. News servers transmit articles back and forth;
they don't track users. There is no central authority.
Usenet is older than the World Wide Web; early versions of it
didn't even use the Internet. (Modern implementations use the
NNTP protocol over TCP/IP.)
Hang around for a while; you'll get the hang of it.
>>> So is there any translation program then to take code for the previous
>>> standard and upgrade it to work with C11 (replace gets by fgets etc)?
>>
>> In a way, yes. Your compiler can help if you if you ask for conformance
>> to a specific standard. That is likely to flag up problems, but it
>> won't fix them, of course. Some, like calls to gets, can't be fixed
>> automatically because the problem is that the function just does not
>> have enough information to do a safe job. Each call needs to be looked
>> at by someone who understands the code.
>>
>> If the code is very old (pre-C90, often called K&R C) you'd have to have
>> a good reason to update it because the move to prototypes alters the way
>> a function is called in subtle ways. If in doubt, ask about that
>> specifically.
>
> Are you sure about this? Industry best practise is -- if possible, be
> backwards compatable; if that can't be done, provide an automatic
> updater. This has always been the case eg with Visual Basic.
>
> It seems quite wreckless to update C while breaking existing programs and
> leaving people to re-code manually!
The gets() function in particular is inherently unsafe. It should not
have been in the language in the first place, and programmers should
never have used it. That's why it was removed from C11. The only
programs that removing gets() might break were broken already, and those
programs *cannot* be fixed other than by manual recoding.
In any case, removing it from the standard doesn't magically remove it
from implementations. Implementers are still free to provide it as an
extension, or simply because they haven't yet fully implemented C11
(most C compilers haven't fully implemented C99 yet).
Note that some implementations already issue warnings for calls to
gets() (this particular warning is from the GNU linker):
c.c:(.text+0x52): warning: the `gets' function is dangerous and should not be used.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Will write code for food.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | Geoff <geoff@invalid.invalid> |
|---|---|
| Date | 2012-02-19 13:58 -0800 |
| Message-ID | <amr2k79f4vu7a5plhuuo8uonmh3eo9o1sh@4ax.com> |
| In reply to | #17617 |
On Sun, 19 Feb 2012 19:53:43 +0000 (UTC), Lord Voldermort <nospam@nospam.com> wrote: >It seems quite wreckless to update C while breaking existing programs and >leaving people to re-code manually! Another aioe troll perhaps? While it might be wreckless, it certainly isn't reckless to update the C standard going forward. Revising the standard might break old programs for compilation on new compilers but the medicine is more beneficial than harmful.
[toc] | [prev] | [next] | [standalone]
| From | Stephen Sprunk <stephen@sprunk.org> |
|---|---|
| Date | 2012-02-19 17:19 -0600 |
| Message-ID | <jhs023$u48$1@dont-email.me> |
| In reply to | #17617 |
On 19-Feb-12 13:53, Lord Voldermort wrote: > Ben Bacarisse writes: >> Lord Voldermort <nospam@nospam.com> writes: <snip> >>> Thx for the info Keiht, sorry about breech of protocol - didnt see a >>> way to tell how many ppl are in this room so didnt know whether it was >>> empty or ppl just missed my post. >> >> Have a read of this: http://en.wikipedia.org/wiki/Usenet to get an >> overview. > > Didnt have time to read all that, Yet you're perfectly willing to waste dozens to thousands of potential readers' time with your misunderstanding? How rude of you. > but just flicking through I didnt see anything about listing other > people currently in this room/browsing the forum/whatever you want to > call it. That's because that's not how USENET works; it is not a live chat room. Your message (slowly) spreads from server to server around the world, and those who are interested will read it when they get around to checking for new messages on their server, which might be hours, days or even years later. Do not expect a response within minutes. Incidentally, with modern threaded newsreaders, replying to your own post does not "bump" it. And failed attempts to do so are more likely to make readers dismiss your question rather than help you, so don't do that. >>> So is there any translation program then to take code for the previous >>> standard and upgrade it to work with C11 (replace gets by fgets etc)? >> >> In a way, yes. Your compiler can help if you if you ask for conformance >> to a specific standard. That is likely to flag up problems, but it >> won't fix them, of course. Some, like calls to gets, can't be fixed >> automatically because the problem is that the function just does not >> have enough information to do a safe job. Each call needs to be looked >> at by someone who understands the code. >> >> If the code is very old (pre-C90, often called K&R C) you'd have to have >> a good reason to update it because the move to prototypes alters the way >> a function is called in subtle ways. If in doubt, ask about that >> specifically. > > Are you sure about this? Industry best practise is -- if possible, be > backwards compatable; if that can't be done, provide an automatic > updater. This has always been the case eg with Visual Basic. That has not been the case for any programming language I've used, but I was never forced to deal with VB. The usual model is that features are deprecated (meaning they still work, but you shouldn't use them, and compilers may complain if you do) for a version or two before being officially removed. > It seems quite wreckless to update C while breaking existing programs and > leaving people to re-code manually! ISO goes to great lengths to reduce the impact of this, and generally only does so when the feature is so unsafe that leaving it in would be more reckless than removing it. Also, some compilers (eg. gcc) offer the ability to compile your program according to a specific version of the standard, not just the latest one. So, if your program is "broken" by a newer version of the standard, eg. C11, you can just tell the compiler to use an older one, eg. C89 or C99. You only need to fix your program if you want to take advantage of the new features in the later version. S -- Stephen Sprunk "God does not play dice." --Albert Einstein CCIE #3723 "God is an inveterate gambler, and He throws the K5SSS dice at every possible opportunity." --Stephen Hawking
[toc] | [prev] | [next] | [standalone]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Date | 2012-02-19 18:41 -0500 |
| Message-ID | <jhs1ag$3l7$1@dont-email.me> |
| In reply to | #17617 |
On 02/19/2012 02:53 PM, Lord Voldermort wrote: > Ben Bacarisse writes: ... >> Have a read of this: http://en.wikipedia.org/wiki/Usenet to get an >> overview. > > Didnt have time to read all that, but just flicking through I didnt see > anything about listing other people currently in this room/browsing the > forum/whatever you want to call it. The key difference between usenet and anything that you could reasonably call a "room" is that with a room, you have a conversation with other people who are currently in the same room. If two people can't can't be in the room at the same time, they can't talk. With usenet, each person checks usenet at the time that is convenient for them, and posts responses when and if they wish to. My impression is that most people who monitor these groups regularly do so at least once per day, but you should never count on people posting more frequently than that, nor at the same time of day that you do, and particular people might miss a day. As a result, usenet conversations can be a lot slower than they are in anything that relies on a "room" metaphor. I recently noticed someone who'd been away for a long time posting a flurry of responses to other people's messages, in many cases more than a month old. That's a bit extreme, but I didn't notice anybody complain about it. In general, people don't seem to start complaining until the message you're replying to is at least several months old. ... >> If the code is very old (pre-C90, often called K&R C) you'd have to have >> a good reason to update it because the move to prototypes alters the way >> a function is called in subtle ways. If in doubt, ask about that >> specifically. > > Are you sure about this? Industry best practise is -- if possible, be > backwards compatable; if that can't be done, provide an automatic > updater. This has always been the case eg with Visual Basic. > > It seems quite wreckless to update C while breaking existing programs and > leaving people to re-code manually! Backwards compatibility is very important to the C committee. If you monitor this newsgroup long enough, you'll discover that in the opinions of several people posting here (not including me) the committee pays far too much attention to backwards compatibility. A key point to remember is that K&R C was not standardized - there were many different versions of C floating around, most of them incompatible with each other to varying degrees. When the C standard came out, it maintained a degree of backwards compatibility by letting many things be unspecified, or implementation-defined, or have undefined behavior - but they also necessarily broke backwards compatibility with many (perhaps most) pre-standard compilers by specifically defining a great many things. When a compiler came out with a new version that fully conformed to the standard, some code necessarily had to be be re-written to work with the conforming version, but a great deal did not have to be re-written, because of the things the standard left unspecified or undefined, which the compiler was therefore free to continue handling the same way it always had. Again, you'll find people posting to this newsgroup who object strenuously to those decisions, preferring that the standard break backwards compatibility more thoroughly than it did, by specifying everything, and leaving nothing undefined. I can sympathize with that desire, but it would have prevented implementation of C on any platform, past, present or future, for which those decisions were incompatible with efficient implementation of C. -- James Kuyper
[toc] | [prev] | [next] | [standalone]
| From | Robert Wessel <robertwessel2@yahoo.com> |
|---|---|
| Date | 2012-02-20 01:51 -0600 |
| Message-ID | <mgu3k7l7falujvpao1n77v0hb32ggfbfdf@4ax.com> |
| In reply to | #17617 |
On Sun, 19 Feb 2012 19:53:43 +0000 (UTC), Lord Voldermort <nospam@nospam.com> wrote: >Ben Bacarisse writes: >> Lord Voldermort <nospam@nospam.com> writes: <snip> >> >>> Thx for the info Keiht, sorry about breech of protocol - didnt see a >>> way to tell how many ppl are in this room so didnt know whether it was >>> empty or ppl just missed my post. >> >> Have a read of this: http://en.wikipedia.org/wiki/Usenet to get an >> overview. > >Didnt have time to read all that, but just flicking through I didnt see >anything about listing other people currently in this room/browsing the >forum/whatever you want to call it. > >>> So is there any translation program then to take code for the previous >>> standard and upgrade it to work with C11 (replace gets by fgets etc)? >> >> In a way, yes. Your compiler can help if you if you ask for conformance >> to a specific standard. That is likely to flag up problems, but it >> won't fix them, of course. Some, like calls to gets, can't be fixed >> automatically because the problem is that the function just does not >> have enough information to do a safe job. Each call needs to be looked >> at by someone who understands the code. >> >> If the code is very old (pre-C90, often called K&R C) you'd have to have >> a good reason to update it because the move to prototypes alters the way >> a function is called in subtle ways. If in doubt, ask about that >> specifically. > >Are you sure about this? Industry best practise is -- if possible, be >backwards compatable; if that can't be done, provide an automatic >updater. This has always been the case eg with Visual Basic. > >It seems quite wreckless to update C while breaking existing programs and >leaving people to re-code manually! You've misunderstood Ben. The addition of function prototypes in the language did not break existing programs. What may cause somewhat subtle problems if you change your K&R style function declarations to prototypes. There are case where the obvious prototype will cause somewhat different behavior, and cases where the exact behavior cannot be matched at all (although such are usually indicative of other problems). But you can just leave your K&R style declarations as-is, and nothing breaks.
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2012-02-20 02:19 -0800 |
| Message-ID | <ln39a5erhs.fsf@nuthaus.mib.org> |
| In reply to | #17637 |
Robert Wessel <robertwessel2@yahoo.com> writes:
> On Sun, 19 Feb 2012 19:53:43 +0000 (UTC), Lord Voldermort
> <nospam@nospam.com> wrote:
[...]
>>Are you sure about this? Industry best practise is -- if possible, be
>>backwards compatable; if that can't be done, provide an automatic
>>updater. This has always been the case eg with Visual Basic.
>>
>>It seems quite wreckless to update C while breaking existing programs and
>>leaving people to re-code manually!
>
> You've misunderstood Ben. The addition of function prototypes in the
> language did not break existing programs. What may cause somewhat
> subtle problems if you change your K&R style function declarations to
> prototypes. There are case where the obvious prototype will cause
> somewhat different behavior, and cases where the exact behavior cannot
> be matched at all (although such are usually indicative of other
> problems). But you can just leave your K&R style declarations as-is,
> and nothing breaks.
Not quite.
Non-prototype declarations are still in the language, up to and
including the 2011 standard (and have been obsolescent since C89).
But C99 removed implicit int, which did break existing code
(though the fix was straightforward and fixed code could still be
compatible with pre-ANSI compilers). C11's removal of gets() also
broke existing code (though such code was already arguably broken).
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Will write code for food.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | Nick Keighley <nick_keighley_nospam@hotmail.com> |
|---|---|
| Date | 2012-02-20 00:45 -0800 |
| Message-ID | <44e03f36-ab00-4cbd-962b-d35ed8516686@t24g2000yqj.googlegroups.com> |
| In reply to | #17602 |
On Feb 19, 10:54 am, Lord Voldermort <nos...@nospam.com> wrote: > Thx try to avoid text-speak > for the info Keiht, try to spell peoples' names correctly > sorry about breech of protocol that's "breach"- your spelling refers to trousers > - didnt see a way > to tell how many ppl are in this room it isn't a room it's a usenet group > so didnt know whether it was empty > or ppl just missed my post. <snip>
[toc] | [prev] | [next] | [standalone]
| From | Nick Keighley <nick_keighley_nospam@hotmail.com> |
|---|---|
| Date | 2012-02-20 00:52 -0800 |
| Message-ID | <bd3798a2-90a4-4be6-a2c4-d097594f100a@b23g2000yqn.googlegroups.com> |
| In reply to | #17602 |
On Feb 19, 10:54 am, Lord Voldermort <nos...@nospam.com> wrote: > So is there any translation program then to take code for the previous > standard and upgrade it to work with C11 (replace gets by fgets etc)? fgets() isn't a straight replacement for gets(). The end-of-line handling is different. I also suspect the "translation program" would have to read your mind in some cases in order to get the buffer size right for fgets(). Do you use gets() a lot, or use programs that do?
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2012-02-20 13:25 +0000 |
| Message-ID | <0.ee91c1f1976309150aa7.20120220132552GMT.87k43htz4v.fsf@bsb.me.uk> |
| In reply to | #17641 |
Nick Keighley <nick_keighley_nospam@hotmail.com> writes:
> On Feb 19, 10:54 am, Lord Voldermort <nos...@nospam.com> wrote:
>
>> So is there any translation program then to take code for the previous
>> standard and upgrade it to work with C11 (replace gets by fgets etc)?
>
> fgets() isn't a straight replacement for gets(). The end-of-line
> handling is different. I also suspect the "translation program" would
> have to read your mind in some cases in order to get the buffer size
> right for fgets(). Do you use gets() a lot, or use programs that do?
If you simply must get your gets-containing code to run today, you can use:
#define gets(s) (scanf("%[^\n]%*c", (s)) == 1 ? (s) : NULL)
but you should fix it tomorrow! (Not you personally, of course, but
"one" is sometimes too formal for Usenet).
--
Ben.
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Date | 2012-02-20 10:33 -0800 |
| Message-ID | <lnty2lcq2l.fsf@nuthaus.mib.org> |
| In reply to | #17658 |
Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
> Nick Keighley <nick_keighley_nospam@hotmail.com> writes:
>> On Feb 19, 10:54 am, Lord Voldermort <nos...@nospam.com> wrote:
>>> So is there any translation program then to take code for the previous
>>> standard and upgrade it to work with C11 (replace gets by fgets etc)?
>>
>> fgets() isn't a straight replacement for gets(). The end-of-line
>> handling is different. I also suspect the "translation program" would
>> have to read your mind in some cases in order to get the buffer size
>> right for fgets(). Do you use gets() a lot, or use programs that do?
>
> If you simply must get your gets-containing code to run today, you can use:
>
> #define gets(s) (scanf("%[^\n]%*c", (s)) == 1 ? (s) : NULL)
>
> but you should fix it tomorrow! (Not you personally, of course, but
> "one" is sometimes too formal for Usenet).
If you simply must get such code running *today*, you can just
leave the gets() call in place. I don't believe there are yet any
hosted C implementations that don't provide it.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Will write code for food.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
[toc] | [prev] | [next] | [standalone]
| From | Quentin Pope <qp19433@hotmail.NOSPAM.com> |
|---|---|
| Date | 2012-02-21 19:51 +0000 |
| Message-ID | <ji0skh$7lc$1@speranza.aioe.org> |
| In reply to | #17658 |
On Mon, 20 Feb 2012 13:25:52 +0000, Ben Bacarisse wrote:
> Nick Keighley <nick_keighley_nospam@hotmail.com> writes:
>
>> On Feb 19, 10:54 am, Lord Voldermort <nos...@nospam.com> wrote:
>>
>>> So is there any translation program then to take code for the previous
>>> standard and upgrade it to work with C11 (replace gets by fgets etc)?
>>
>> fgets() isn't a straight replacement for gets(). The end-of-line
>> handling is different. I also suspect the "translation program" would
>> have to read your mind in some cases in order to get the buffer size
>> right for fgets(). Do you use gets() a lot, or use programs that do?
>
> If you simply must get your gets-containing code to run today, you can
> use:
>
> #define gets(s) (scanf("%[^\n]%*c", (s)) == 1 ? (s) : NULL)
>
> but you should fix it tomorrow! (Not you personally, of course, but
> "one" is sometimes too formal for Usenet).
Does that mean that the identifier gets has been returned to the user's
namespace? That sounds like a recipe for confusion if people try to mix
old code with C11 code that uses gets for something unrelated to the
original function.
//QP
[toc] | [prev] | [next] | [standalone]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Date | 2012-02-21 15:11 -0500 |
| Message-ID | <4F43FA5F.2060507@verizon.net> |
| In reply to | #17747 |
On 02/21/2012 02:51 PM, Quentin Pope wrote: ... > Does that mean that the identifier gets has been returned to the user's > namespace? ... Yes. In the new standard, gets() is only mentioned in two places: Forward: as something that has been removed. Footnote 440: as something to compare gets_s() to. Therefore, it is no longer counts as one of the identifier referred to by 7.1.3p1. > ... That sounds like a recipe for confusion if people try to mix > old code with C11 code that uses gets for something unrelated to the > original function. True, but all of the other reserved identifiers are either generically reserved to implementation for certain purposes, specifically reserved for current standard-defined uses, or specifically reserved in anticipation of future standard-defined uses. There's no precedent for adding a specific obsolete identifier to the reserved list - and this version of the standard establishes a precedent for not doing so. For the next decade or two, any decent C2011+ compiler will probably have an option that warns about user-provided definitions of 'gets', but I wouldn't recommend counting on that in the long-term.
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.c
csiph-web