Has Implicit Int been disabled in the new C11 standard? What aboutother previously depreciated const

Discussion in 'C Programming' started by Lord Voldermort, Feb 18, 2012.

  1. As per subject.

    Thanks.

    Tom R.
    Lord Voldermort, Feb 18, 2012
    #1
    1. Advertising

  2. Re: Has Implicit Int been disabled in the new C11 standard? Whatabout other previously depreciated constructions eg gets?

    Lord Voldermort writes:
    > As per subject.
    >
    > Thanks.
    >
    > Tom R.


    *BUMP*

    Anyone able to answer this q?
    Lord Voldermort, Feb 18, 2012
    #2
    1. Advertising

  3. Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets?

    Lord Voldermort <> 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.
    Ben Bacarisse, Feb 18, 2012
    #3
  4. Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets?

    Lord Voldermort <> 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) <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"
    Keith Thompson, Feb 18, 2012
    #4
  5. Lord Voldermort

    Kaz Kylheku Guest

    Re: Has Implicit Int been disabled in the new C11 standard? Whatabout other previously depreciated constructions eg gets?

    On 2012-02-18, Lord Voldermort <> wrote:
    > Lord Voldermort writes:
    >> As per subject.
    >>
    >> Thanks.
    >>
    >> Tom R.

    >
    > *BUMP*


    Don't do this; Usenet is not a web bulletin board.
    Kaz Kylheku, Feb 19, 2012
    #5
  6. Re: Has Implicit Int been disabled in the new C11 standard? Whatabout other previously depreciated constructions eg gets?

    Keith Thompson writes:
    > Lord Voldermort <> 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)?
    Lord Voldermort, Feb 19, 2012
    #6
  7. Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets?

    Lord Voldermort <> 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.
    Ben Bacarisse, Feb 19, 2012
    #7
  8. Re: Has Implicit Int been disabled in the new C11 standard? Whatabout other previously depreciated constructions eg gets?

    Ben Bacarisse writes:
    > Lord Voldermort <> 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!
    Lord Voldermort, Feb 19, 2012
    #8
  9. Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets?

    Lord Voldermort <> writes:
    > Ben Bacarisse writes:
    >> Lord Voldermort <> 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) <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"
    Keith Thompson, Feb 19, 2012
    #9
  10. Lord Voldermort

    Geoff Guest

    Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets?

    On Sun, 19 Feb 2012 19:53:43 +0000 (UTC), Lord Voldermort
    <> 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.
    Geoff, Feb 19, 2012
    #10
  11. Re: Has Implicit Int been disabled in the new C11 standard? Whatabout other previously depreciated constructions eg gets?

    On 19-Feb-12 13:53, Lord Voldermort wrote:
    > Ben Bacarisse writes:
    >> Lord Voldermort <> 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
    Stephen Sprunk, Feb 19, 2012
    #11
  12. Re: Has Implicit Int been disabled in the new C11 standard? Whatabout other previously depreciated constructions eg gets?

    On Feb 19, 10:54 am, Lord Voldermort <> 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>
    Nick Keighley, Feb 20, 2012
    #12
  13. Re: Has Implicit Int been disabled in the new C11 standard? Whatabout other previously depreciated constructions eg gets?

    On Feb 19, 10:54 am, Lord Voldermort <> 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?
    Nick Keighley, Feb 20, 2012
    #13
  14. Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets?

    Robert Wessel <> writes:
    > On Sun, 19 Feb 2012 19:53:43 +0000 (UTC), Lord Voldermort
    > <> 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) <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"
    Keith Thompson, Feb 20, 2012
    #14
  15. Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets?

    Nick Keighley <> writes:

    > On Feb 19, 10:54 am, Lord Voldermort <> 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.
    Ben Bacarisse, Feb 20, 2012
    #15
  16. Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets?

    Ben Bacarisse <> writes:
    > Nick Keighley <> writes:
    >> On Feb 19, 10:54 am, Lord Voldermort <> 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) <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"
    Keith Thompson, Feb 20, 2012
    #16
  17. Lord Voldermort

    Quentin Pope Guest

    Re: Has Implicit Int been disabled in the new C11 standard? Whatabout other previously depreciated constructions eg gets?

    On Mon, 20 Feb 2012 13:25:52 +0000, Ben Bacarisse wrote:
    > Nick Keighley <> writes:
    >
    >> On Feb 19, 10:54 am, Lord Voldermort <> 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
    Quentin Pope, Feb 21, 2012
    #17
  18. Lord Voldermort

    James Kuyper Guest

    Re: Has Implicit Int been disabled in the new C11 standard? Whatabout other previously depreciated constructions eg gets?

    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.
    James Kuyper, Feb 21, 2012
    #18
  19. Lord Voldermort

    Jens Gustedt Guest

    Re: Has Implicit Int been disabled in the new C11 standard? Whatabout other previously depreciated constructions eg gets?

    Hello,

    Am 02/21/2012 09:11 PM, schrieb James Kuyper:
    > 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. ...
    >
    > 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.


    Probably this is just something that nobody thought about, since it
    never happened before. Sounds like a good point for a DR.

    Jens
    Jens Gustedt, Feb 22, 2012
    #19
  20. Re: Has Implicit Int been disabled in the new C11 standard? What about other previously depreciated constructions eg gets?

    Jens Gustedt <> writes:
    > Am 02/21/2012 09:11 PM, schrieb James Kuyper:
    >> 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. ...
    >>
    >> 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.

    >
    > Probably this is just something that nobody thought about, since it
    > never happened before. Sounds like a good point for a DR.


    It's unlikely that nobody thought about it. I seem to recall it being
    discussed in comp.std.c.

    --
    Keith Thompson (The_Other_Keith) <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"
    Keith Thompson, Feb 22, 2012
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Krussow
    Replies:
    2
    Views:
    619
    Richard
    Jan 17, 2005
  2. Replies:
    11
    Views:
    1,082
  3. KC Sparks
    Replies:
    0
    Views:
    39
    KC Sparks
    May 27, 2014
  4. Chris Angelico
    Replies:
    0
    Views:
    51
    Chris Angelico
    May 27, 2014
  5. Dave Angel
    Replies:
    0
    Views:
    46
    Dave Angel
    May 27, 2014
Loading...

Share This Page