Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #112621
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Freestanding Environment |
| Date | 2017-06-19 12:39 -0700 |
| Organization | None to speak of |
| Message-ID | <ln37avg41u.fsf@kst-u.example.com> (permalink) |
| References | (4 earlier) <4e525014-ab98-472f-9715-338286b64a1e@googlegroups.com> <n6cekclhvh5jasaiqetblgnhp0mrq2v268@4ax.com> <68adbb20-e9e5-44fe-9af2-9bf9c8afc468@googlegroups.com> <lnh8zcgdpo.fsf@kst-u.example.com> <ee6dd3de-5315-4705-a744-d505a7fa2a41@googlegroups.com> |
supercat@casperkitty.com writes:
> On Monday, June 19, 2017 at 11:11:07 AM UTC-5, Keith Thompson wrote:
>> The phrase "*the* function called at program startup" seems to me to
>> imply that there is one such function for a given implementation.
>> It might not be called "main", and it might have different type
>> than the main function used by a hosted implementation.
>
> There are many freestanding implementations whose purpose, in at least some
> configurations, is to generate machine code for functions that can be called
> from other programs the implementation knows nothing about. There is no
> reason that a collection of source files should be limited to generating code
> for a single such function.
The same is true for hosted implementations.
For a hosted implementation, execution begins with an implicit call to
main, which can then call other functions. The major difference for
freestanding implementations, as described by the standard, is that the
startup function might not be called "main" and might have an arbitrary
implementation-defined type (parameters and return type).
> If an imple,mentation is instructed to generate machine code that will be
> loaded at address 0x40001F00..0x40001FFF and may treat that range as RAM,
> that it should contain two functions:
>
> static uint32_t counter;
> uint32_t read_and_inc_counter(void) { return counter++; }
> void set_counter(uint32_t n) { counter = n; }
>
> and that the entry point for the first function should be at 0x40001F00 and
> the second at 0x40001F04, then the concept of "program startup" would not
> be unambiguously defined by the Standard. Is each call to either function
> regarded as "starting up" the program, or is only the first call to either
> function considered a startup, or what?
Compiling C code to be called from other languages is certainly useful,
but it's outside the scope of the C standard.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Freestanding Environment David Kleinecke <dkleinecke@gmail.com> - 2017-06-17 19:58 -0700
Re: Freestanding Environment Robert Wessel <robertwessel2@yahoo.com> - 2017-06-18 00:15 -0500
Re: Freestanding Environment David Kleinecke <dkleinecke@gmail.com> - 2017-06-17 23:51 -0700
Re: Freestanding Environment Robert Wessel <robertwessel2@yahoo.com> - 2017-06-18 02:31 -0500
Re: Freestanding Environment David Kleinecke <dkleinecke@gmail.com> - 2017-06-18 14:08 -0700
Re: Freestanding Environment Robert Wessel <robertwessel2@yahoo.com> - 2017-06-18 21:19 -0500
Re: Freestanding Environment David Kleinecke <dkleinecke@gmail.com> - 2017-06-18 19:49 -0700
Re: Freestanding Environment Keith Thompson <kst-u@mib.org> - 2017-06-19 09:10 -0700
Re: Freestanding Environment supercat@casperkitty.com - 2017-06-19 09:42 -0700
Re: Freestanding Environment scott@slp53.sl.home (Scott Lurndal) - 2017-06-19 16:51 +0000
Re: Freestanding Environment supercat@casperkitty.com - 2017-06-19 12:26 -0700
Re: Freestanding Environment scott@slp53.sl.home (Scott Lurndal) - 2017-06-19 19:37 +0000
Re: Freestanding Environment David Kleinecke <dkleinecke@gmail.com> - 2017-06-19 17:51 -0700
Re: Freestanding Environment Keith Thompson <kst-u@mib.org> - 2017-06-19 12:39 -0700
Re: Freestanding Environment David Kleinecke <dkleinecke@gmail.com> - 2017-06-19 17:45 -0700
Re: Freestanding Environment Keith Thompson <kst-u@mib.org> - 2017-06-20 08:32 -0700
Re: Freestanding Environment David Kleinecke <dkleinecke@gmail.com> - 2017-06-20 12:29 -0700
Re: Freestanding Environment raltbos@xs4all.nl (Richard Bos) - 2017-06-26 15:58 +0000
Re: Freestanding Environment David Kleinecke <dkleinecke@gmail.com> - 2017-06-26 09:25 -0700
Re: Freestanding Environment raltbos@xs4all.nl (Richard Bos) - 2017-06-26 20:17 +0000
Re: Freestanding Environment David Kleinecke <dkleinecke@gmail.com> - 2017-06-26 14:03 -0700
Re: Freestanding Environment joel.rees@gmail.com - 2017-06-27 18:04 -0700
Re: Freestanding Environment James Kuyper <jameskuyper@verizon.net> - 2017-06-27 21:47 -0400
Re: Freestanding Environment bartc <bc@freeuk.com> - 2017-06-28 11:45 +0100
Re: Freestanding Environment Tim Rentsch <txr@alumni.caltech.edu> - 2017-06-28 03:55 -0700
Re: Freestanding Environment Richard Heathfield <rjh@cpax.org.uk> - 2017-06-28 12:32 +0100
Re: Freestanding Environment Tim Rentsch <txr@alumni.caltech.edu> - 2017-06-28 05:45 -0700
Re: Freestanding Environment James Harris <james.harris.1@gmail.com> - 2017-06-28 21:42 +0100
Re: Freestanding Environment scott@slp53.sl.home (Scott Lurndal) - 2017-06-29 13:27 +0000
Re: Freestanding Environment Mark Storkamp <mstorkamp@yahoo.com> - 2017-06-29 08:44 -0500
Re: Freestanding Environment scott@slp53.sl.home (Scott Lurndal) - 2017-06-29 13:54 +0000
Re: Freestanding Environment Mark Storkamp <mstorkamp@yahoo.com> - 2017-06-29 11:11 -0500
Re: Freestanding Environment scott@slp53.sl.home (Scott Lurndal) - 2017-06-29 16:45 +0000
Re: Freestanding Environment Robert Wessel <robertwessel2@yahoo.com> - 2017-06-30 00:34 -0500
Re: Freestanding Environment Jerry Stuckle <jstucklex@attglobal.net> - 2017-06-29 16:07 -0400
Re: Freestanding Environment James Kuyper <jameskuyper@verizon.net> - 2017-06-28 16:53 -0400
Re: Freestanding Environment James Harris <james.harris.1@gmail.com> - 2017-06-29 10:58 +0100
Re: Freestanding Environment "James R. Kuyper" <jameskuyper@verizon.net> - 2017-06-29 12:19 -0400
Re: Freestanding Environment James Harris <james.harris.1@gmail.com> - 2017-06-30 08:16 +0100
Re: Freestanding Environment Robert Wessel <robertwessel2@yahoo.com> - 2017-06-28 11:28 -0500
Re: Freestanding Environment James Kuyper <jameskuyper@verizon.net> - 2017-06-28 14:38 -0400
Re: Freestanding Environment scott@slp53.sl.home (Scott Lurndal) - 2017-06-28 18:48 +0000
Re: Freestanding Environment Jerry Stuckle <jstucklex@attglobal.net> - 2017-06-26 16:42 -0400
Re: Freestanding Environment David Kleinecke <dkleinecke@gmail.com> - 2017-06-26 14:05 -0700
Re: Freestanding Environment Jerry Stuckle <jstucklex@attglobal.net> - 2017-06-26 17:31 -0400
Re: Freestanding Environment joel.rees@gmail.com - 2017-06-27 02:36 -0700
Re: Freestanding Environment scott@slp53.sl.home (Scott Lurndal) - 2017-06-27 12:43 +0000
Re: Freestanding Environment Robert Wessel <robertwessel2@yahoo.com> - 2017-06-27 09:50 -0500
Re: Freestanding Environment joel.rees@gmail.com - 2017-06-27 18:11 -0700
Re: Freestanding Environment "Patrick.Schluter" <Patrick.Schluter@free.fr> - 2017-06-20 20:22 +0200
Re: Freestanding Environment David Kleinecke <dkleinecke@gmail.com> - 2017-06-20 12:33 -0700
Re: Freestanding Environment scott@slp53.sl.home (Scott Lurndal) - 2017-06-19 13:11 +0000
Re: Freestanding Environment Mark Storkamp <mstorkamp@yahoo.com> - 2017-06-19 08:53 -0500
Re: Freestanding Environment scott@slp53.sl.home (Scott Lurndal) - 2017-06-19 13:08 +0000
Re: Freestanding Environment David Kleinecke <dkleinecke@gmail.com> - 2017-06-19 17:40 -0700
Re: Freestanding Environment Tim Rentsch <txr@alumni.caltech.edu> - 2017-06-19 04:16 -0700
Re: Freestanding Environment supercat@casperkitty.com - 2017-06-19 07:59 -0700
csiph-web