L
Lord Voldermort
As per subject.
Thanks.
Tom R.
Thanks.
Tom R.
Lord Voldermort said:*BUMP*
Anyone able to answer this q?
Lord Voldermort said:As per subject.
Thanks.
Tom R.
Has Implicit Int been disabled in the new C11 standard?
What about other previously depreciated constructions eg gets?
*BUMP*
Keith said: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:
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).
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)?
Ben said:Have a read of this: http://en.wikipedia.org/wiki/Usenet to get an
overview.
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.
Lord Voldermort said: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.
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!
It seems quite wreckless to update C while breaking existing programs and
leaving people to re-code manually!
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.
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!
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)?
Robert Wessel said:On Sun, 19 Feb 2012 19:53:43 +0000 (UTC), Lord Voldermort
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.
Nick Keighley said: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?
Ben Bacarisse said:Nick Keighley said: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).
Nick Keighley said: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.
On 02/21/2012 02:51 PM, Quentin Pope wrote:
...
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.
Jens Gustedt said:Am 02/21/2012 09:11 PM, schrieb James Kuyper:
Probably this is just something that nobody thought about, since it
never happened before. Sounds like a good point for a DR.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.