c99

Is a compiler allowed to add functions to standard headers?

╄→гoц情女王★ 提交于 2019-12-28 06:58:11
问题 Is a C compiler allowed to add functions to standard headers and still conform to the C standard? I read this somewhere, but I can't find any reference in the standard, except in annex J.5: The inclusion of any extension that may cause a strictly conforming program to become invalid renders an implementation nonconforming. Examples of such extensions are new keywords, extra library functions declared in standard headers , or predefined macros with names that do not begin with an underscore.

Can I omit return from main in C? [duplicate]

我的梦境 提交于 2019-12-28 06:45:17
问题 This question already has answers here : What should main() return in C and C++? (17 answers) Closed 6 months ago . In C++, 3.6.1 Main function (3.6.1/5) A return statement in main has the effect of leaving the main function (destroying any objects with automatic storage duration) and calling exit with the return value as the argument. If control reaches the end of main without encountering a return statement, the effect is that of executing return 0; Can I do the following in C99 without

What is wrong with using turbo C?

允我心安 提交于 2019-12-28 04:23:27
问题 I always find that some people (a majority from India) are using turbo C. I cannot find any reason to use such outdated compiler... But I don't know what reasons to give when trying to tell them to use modern compiler(gcc,msvc,...). 回答1: Turbo C is a DOS only product. This means that it no longer runs "natively" on 64-bit versions of Windows, and must be run inside the XP compatibility penalty box. 回答2: While there are plenty of reasons not to use Turbo C (it's old, predates standards,

Is there a meaningful distinction between freestanding and hosted implementations?

≡放荡痞女 提交于 2019-12-28 02:13:08
问题 The question I have is mostly related to section four, paragraph six. The two forms of conforming implementation are hosted and freestanding. A conforming hosted implementation shall accept any strictly conforming program. As I understand, this constitutes the typical application environment, with filesystems, allocated memory and threads... A conforming freestanding implementation shall accept any strictly conforming program in which the use of the features specified in the library clause

Does the C standard consider that there are one or two 'struct uperms_entry' types in this header?

谁说我不能喝 提交于 2019-12-27 11:48:07
问题 Can you give chapter and verse from one of the three C standards (preferably C99 or C11) which indicates whether the following header file has one or two struct uperms_entry types in it? #ifndef UPERMS_CACHE_INCLUDE #define UPERMS_CACHE_INCLUDE typedef struct mutex MT_MUTEX; typedef struct uperms_cache { MT_MUTEX *cache_lock; int processing; struct uperms_entry *uperms_list; // No prior struct uperms_entry } uperms_cache_t; typedef struct uperms_entry // Does this define a different struct

Is stdout line buffered, unbuffered or indeterminate by default?

我是研究僧i 提交于 2019-12-27 09:08:12
问题 Section 7.9.13/7 of c99 states that: At program start-up, three text streams are predefined and need not be opened explicitly - standard input (for reading conventional input), standard output (for writing conventional output), and standard error (for writing diagnostic output). As initially opened, the standard error stream is not fully buffered; the standard input and standard output streams are fully buffered if and only if the stream can be determined not to refer to an interactive device

Are prototypes required for all functions in C89, C90 or C99?

家住魔仙堡 提交于 2019-12-27 09:01:57
问题 To be truly standards-compliant, must all functions in C (except for main) have a prototype, even if they are only used after their definition in the same translation unit? 回答1: It depends on what you mean by 'truly standards compliant'. However, the short answer is "it is a good idea to ensure that all functions have a prototype in scope before being used". A more qualified answer notes that if the function accepts variable arguments (notably the printf() family of functions), then a

Are prototypes required for all functions in C89, C90 or C99?

为君一笑 提交于 2019-12-27 09:01:19
问题 To be truly standards-compliant, must all functions in C (except for main) have a prototype, even if they are only used after their definition in the same translation unit? 回答1: It depends on what you mean by 'truly standards compliant'. However, the short answer is "it is a good idea to ensure that all functions have a prototype in scope before being used". A more qualified answer notes that if the function accepts variable arguments (notably the printf() family of functions), then a

Are prototypes required for all functions in C89, C90 or C99?

北战南征 提交于 2019-12-27 09:01:06
问题 To be truly standards-compliant, must all functions in C (except for main) have a prototype, even if they are only used after their definition in the same translation unit? 回答1: It depends on what you mean by 'truly standards compliant'. However, the short answer is "it is a good idea to ensure that all functions have a prototype in scope before being used". A more qualified answer notes that if the function accepts variable arguments (notably the printf() family of functions), then a

C99 Enum - Need Clarification

放肆的年华 提交于 2019-12-25 11:54:26
问题 I have reviewed this but the accepted answer doesn't make sense to me. I should be able to define an enum in C99 as enum WeekDays { MON, TUES, WED, THURS, FRI, SAT, SUN }days; and utilize the enum as follows in main as days = FRI; if (days == FRI) { printf("Thank God it's Friday!"); } Why the additional work in the accepted answer to utilize the enum? 回答1: Your code should work. In general though the accepted answer you point to is better programming practice. It's desirable to separate the