Deutsch   English   Français   Italiano  
<86ecyronqa.fsf@linuxsc.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups: comp.lang.c
Subject: Re: Suggested method for returning a string from a C program?
Date: Thu, 20 Mar 2025 06:06:37 -0700
Organization: A noiseless patient Spider
Lines: 87
Message-ID: <86ecyronqa.fsf@linuxsc.com>
References: <vrd77d$3nvtf$2@dont-email.me> <87a59hvgyk.fsf@nosuchdomain.example.com> <vrdi0g$47cb$3@dont-email.me> <vrdifm$4n2o$1@dont-email.me> <vrdj4b$47cb$4@dont-email.me> <vrdkcb$4n2o$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Thu, 20 Mar 2025 14:06:40 +0100 (CET)
Injection-Info: dont-email.me; posting-host="7c01e97b5d1836204810413d59dbf156";
	logging-data="3463173"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/zbVzWWDpcdBGYrSku1wUIwj4nWDcQ8FU="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:vkZKE2RaLWZLPftpBs708l4wUGA=
	sha1:RdhbSCh0iS1xYKyx4keaIQu4bCA=
Bytes: 3981

Richard Heathfield <rjh@cpax.org.uk> writes:

> On 19/03/2025 05:02, DFS wrote:
>
>> On 3/19/2025 12:51 AM, Richard Heathfield wrote:
>>
>>> On 19/03/2025 04:42, DFS wrote:
>>>
>>>> Pretty easy fixes:
>>>>
>>>> 1 use scanf()
>>>> 2 update int to long
>>>> 3 handle special case of n = 1
>>>> 4 instead of collecting the results in a char variable, I print
>>>>  them as they're calculated
>>>
>>> You've also fixed another glitch which may or may not have been
>>> significant:
>>>
>>> $ file post2.txt
>>> post2.txt: news, ASCII text
>>>
>>> So wherever that UTF-8 came from, it's gone now.
>>
>> Cool.  Thanks for looking at it.
>>
>> Hey, how are your C book (from 2000) sales?  Thought about a new
>> edition?
>
> I'm not sure a new edition is necessary, but if it is to be
> written it would be better served by someone like Keith or Tim,
> both of whom have (as I have not) kept up with the million-and-one
> changes that appear to have assailed the simple language I once
> enjoyed.

The C99 standard has a list of 54 what it calls "major changes",
although IMO many or most of those are fairly minor.  There are also
other differences relative to C90, but most of them are simply
clarifications or slight changes in wording.

I went through the list of major changes and selected out the items
I consider the most significant.  Here they are, organized into
several related areas.

Language constructs taken out from C90:
    REMOVED: implicit int
    REMOVED: implicit function declaration

Comments:
    // comments are now allowed

Preprocessor:
    empty macro arguments
    macros with variable number of arguments

Lexical:
    improved lower bounds for identifier length -
       went from 6 and 31 (for global and non-global) in C90
       to 31 and 63 in C99

Types added:
    boolean type _Bool
    complex numbers
    long long and unsigned long long

New language constructs:
    more general initialization for aggregates and unions
    compound literals
    designated initializers
    mixing of declarations and code (including in for() initializers)

Array related:
    arrays and array types with non-constant extents, aka
       VLA, for variable length arrays, and
       VMT, for variably modified type
    flexible array members (recognizing the "struct hack")

Miscellaneous:
    'inline' functions
    return with expression now disallowed in void function,
       and vice versa

I included the "array related" items, and also complex numbers, as
significant items, even though they aren't used very often.  I think
it's important to know about these features, despite their
infrequent use.  (Incidentally, both complex numbers and VLA/VMT
were made optional in C11.)