Deutsch English Français Italiano |
<6a0172b8fe12171901a97032b8a91641308fdc50@i2pn2.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder9.news.weretis.net!i2pn.org!i2pn2.org!.POSTED!not-for-mail From: Richard Damon <richard@damon-family.org> Newsgroups: comp.lang.c Subject: Re: relearning C: why does an in-place change to a char* segfault? Date: Sun, 4 Aug 2024 07:22:57 -0400 Organization: i2pn2 (i2pn.org) Message-ID: <6a0172b8fe12171901a97032b8a91641308fdc50@i2pn2.org> References: <IoGcndcJ1Zm83zb7nZ2dnZfqnPWdnZ2d@brightview.co.uk> <20240801114615.906@kylheku.com> <v8gs06$2ceis$1@dont-email.me> <v8jlnk$31hqf$1@dont-email.me> <87bk29duba.fsf@nosuchdomain.example.com> <v8mkao$3n2rq$5@dont-email.me> <8734nldmea.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sun, 4 Aug 2024 11:22:57 -0000 (UTC) Injection-Info: i2pn2.org; logging-data="1423573"; mail-complaints-to="usenet@i2pn2.org"; posting-account="diqKR1lalukngNWEqoq9/uFtbkm5U+w3w6FQ0yesrXg"; User-Agent: Mozilla Thunderbird X-Spam-Checker-Version: SpamAssassin 4.0.0 Content-Language: en-US In-Reply-To: <8734nldmea.fsf@nosuchdomain.example.com> Bytes: 2462 Lines: 29 On 8/3/24 10:58 PM, Keith Thompson wrote: > Lawrence D'Oliveiro <ldo@nz.invalid> writes: >> On Sat, 03 Aug 2024 17:07:37 -0700, Keith Thompson wrote: >> >>> ... general compression isn't something I've seen ... >> >> I recall Apple had a patent on some aspects of the “PEF” executable format >> that they created for their PowerPC machines running old MacOS. This had >> to do with some clever instruction encodings for loading stuff into >> memory. > > Is that relevant to what I asked about? > > What I had in mind is something that, given this: > > static int buf = { 1, 1, 1, ..., 1 }; // say, 1000 elements > > would store something less than 1000*sizeof(int) bytes in the executable > file. I wouldn't be hard to do, but I'm not convinced it would be > worthwhile. > I vaguely seem to remember an embedded format that did something like this. The .init segement that was "copied" to the .data segement has a simple run-length encoding option. For non-repetitive data, it just encoded 1 copy of length n. But it could also encode repeats like your example. When EPROM was a scarce commodity squeezing out a bit of size for the .init segment was useful. My guess that since it didn't persist, it didn't actually help that much.