Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #382985 > unrolled thread
| Started by | Lawrence D'Oliveiro <ldo@nz.invalid> |
|---|---|
| First post | 2024-02-24 23:05 +0000 |
| Last post | 2024-02-29 19:08 +0100 |
| Articles | 20 on this page of 111 — 15 participants |
Back to article view | Back to comp.lang.c
Implicit String-Literal Concatenation Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-24 23:05 +0000
Re: Implicit String-Literal Concatenation Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-02-25 17:38 +0100
Re: Implicit String-Literal Concatenation Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-25 20:43 +0000
Re: Implicit String-Literal Concatenation bart <bc@freeuk.com> - 2024-02-25 21:20 +0000
Re: Implicit String-Literal Concatenation Blue-Maned_Hawk <bluemanedhawk@invalid.invalid> - 2024-02-25 16:45 +0000
Re: Implicit String-Literal Concatenation Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-25 20:25 +0000
Re: Implicit String-Literal Concatenation Łukasz 'Maly' Ostrowski <l3vi4than@gmail.com> - 2024-02-26 21:12 +0100
Re: Implicit String-Literal Concatenation Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-26 20:31 +0000
Re: Implicit String-Literal Concatenation Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-02-27 13:18 +0100
Re: Implicit String-Literal Concatenation Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-27 23:10 +0000
Re: Implicit String-Literal Concatenation Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-02-28 00:50 +0100
Re: Implicit String-Literal Concatenation Kaz Kylheku <433-929-6894@kylheku.com> - 2024-02-26 20:42 +0000
Re: Implicit String-Literal Concatenation porkchop@invalid.foo (Mike Sanders) - 2024-02-26 22:03 +0000
Re: Implicit String-Literal Concatenation Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-26 23:17 +0000
Re: Implicit String-Literal Concatenation porkchop@invalid.foo (Mike Sanders) - 2024-02-27 17:27 +0000
Re: Implicit String-Literal Concatenation David Brown <david.brown@hesbynett.no> - 2024-02-27 09:36 +0100
Re: Implicit String-Literal Concatenation porkchop@invalid.foo (Mike Sanders) - 2024-02-27 17:31 +0000
Re: Implicit String-Literal Concatenation bart <bc@freeuk.com> - 2024-02-27 18:56 +0000
Re: Implicit String-Literal Concatenation David Brown <david.brown@hesbynett.no> - 2024-02-27 23:21 +0100
Re: Implicit String-Literal Concatenation Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-27 22:52 +0000
Re: Implicit String-Literal Concatenation Kaz Kylheku <433-929-6894@kylheku.com> - 2024-02-28 01:09 +0000
Re: Implicit String-Literal Concatenation David Brown <david.brown@hesbynett.no> - 2024-02-28 12:50 +0100
Re: Implicit String-Literal Concatenation Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-28 20:56 +0000
Re: Implicit String-Literal Concatenation bart <bc@freeuk.com> - 2024-02-28 21:34 +0000
Re: Implicit String-Literal Concatenation Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-28 23:52 +0000
Re: Implicit String-Literal Concatenation bart <bc@freeuk.com> - 2024-02-29 00:15 +0000
Re: Implicit String-Literal Concatenation Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-29 02:53 +0000
Re: Implicit String-Literal Concatenation bart <bc@freeuk.com> - 2024-02-29 09:20 +0000
Re: Implicit String-Literal Concatenation scott@slp53.sl.home (Scott Lurndal) - 2024-02-29 15:48 +0000
Re: Implicit String-Literal Concatenation Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-02-29 17:03 +0100
Re: Implicit String-Literal Concatenation scott@slp53.sl.home (Scott Lurndal) - 2024-02-29 16:17 +0000
Re: Implicit String-Literal Concatenation Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-02-29 18:12 +0100
Re: Implicit String-Literal Concatenation scott@slp53.sl.home (Scott Lurndal) - 2024-02-29 17:30 +0000
Re: Implicit String-Literal Concatenation Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-02-29 13:20 -0800
Re: Implicit String-Literal Concatenation bart <bc@freeuk.com> - 2024-02-29 21:44 +0000
Re: Implicit String-Literal Concatenation Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-02-29 14:06 -0800
Re: Implicit String-Literal Concatenation Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-03-01 18:09 +0100
Re: Implicit String-Literal Concatenation Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-03-01 10:49 -0800
Re: Implicit String-Literal Concatenation Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-03-01 22:06 +0100
Re: Implicit String-Literal Concatenation Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-02-29 09:20 -0800
Re: Implicit String-Literal Concatenation David Brown <david.brown@hesbynett.no> - 2024-02-29 08:58 +0100
Re: Implicit String-Literal Concatenation Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-29 21:05 +0000
Re: Implicit String-Literal Concatenation David Brown <david.brown@hesbynett.no> - 2024-03-01 09:16 +0100
Re: Implicit String-Literal Concatenation Kaz Kylheku <433-929-6894@kylheku.com> - 2024-03-01 16:55 +0000
Re: Implicit String-Literal Concatenation David Brown <david.brown@hesbynett.no> - 2024-03-01 18:28 +0100
Re: Implicit String-Literal Concatenation Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-27 20:25 +0000
Re: Implicit String-Literal Concatenation Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-02-27 12:35 -0800
Re: Implicit String-Literal Concatenation Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-27 23:03 +0000
Re: Implicit String-Literal Concatenation bart <bc@freeuk.com> - 2024-02-27 22:12 +0000
Re: Implicit String-Literal Concatenation David Brown <david.brown@hesbynett.no> - 2024-02-28 12:54 +0100
Re: Implicit String-Literal Concatenation bart <bc@freeuk.com> - 2024-02-28 13:13 +0000
Re: Implicit String-Literal Concatenation David Brown <david.brown@hesbynett.no> - 2024-02-28 15:08 +0100
Re: Implicit String-Literal Concatenation Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-02-28 13:36 -0800
Re: Implicit String-Literal Concatenation Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2024-02-29 11:56 +0000
Re: Implicit String-Literal Concatenation David Brown <david.brown@hesbynett.no> - 2024-02-29 16:19 +0100
Re: Implicit String-Literal Concatenation Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-29 21:36 +0000
Re: Implicit String-Literal Concatenation Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-02-29 13:53 -0800
Re: Implicit String-Literal Concatenation Richard Harnden <richard.nospam@gmail.invalid> - 2024-03-01 12:59 +0000
Re: Implicit String-Literal Concatenation Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-03-01 20:59 +0000
Re: Implicit String-Literal Concatenation Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-02-29 08:08 -0800
Re: Implicit String-Literal Concatenation bart <bc@freeuk.com> - 2024-02-29 14:31 +0000
Re: Implicit String-Literal Concatenation Richard Harnden <richard.nospam@gmail.invalid> - 2024-02-29 15:22 +0000
Re: Implicit String-Literal Concatenation "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-02-29 13:10 -0800
Re: Implicit String-Literal Concatenation Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-02-29 13:45 -0800
Re: Implicit String-Literal Concatenation "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-02-29 14:03 -0800
Re: Implicit String-Literal Concatenation Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-02-29 14:14 -0800
Re: Implicit String-Literal Concatenation "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-02 13:48 -0800
Re: Implicit String-Literal Concatenation Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-03-05 04:48 +0000
Re: Implicit String-Literal Concatenation Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-03-04 20:55 -0800
Re: Implicit String-Literal Concatenation Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-03-07 21:08 +0000
Re: Implicit String-Literal Concatenation Kaz Kylheku <433-929-6894@kylheku.com> - 2024-03-07 21:44 +0000
Re: Implicit String-Literal Concatenation Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-03-07 14:25 -0800
Re: Implicit String-Literal Concatenation Kaz Kylheku <433-929-6894@kylheku.com> - 2024-03-07 23:00 +0000
Re: Implicit String-Literal Concatenation Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-03-07 15:46 -0800
Re: Implicit String-Literal Concatenation "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-03-07 16:17 -0800
Re: Implicit String-Literal Concatenation Richard Harnden <richard.nospam@gmail.invalid> - 2024-03-08 00:26 +0000
Re: Implicit String-Literal Concatenation Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-03-07 14:16 -0800
Re: Implicit String-Literal Concatenation David Brown <david.brown@hesbynett.no> - 2024-02-29 16:30 +0100
Re: Implicit String-Literal Concatenation Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-02-29 08:25 -0800
Re: Implicit String-Literal Concatenation Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-02-29 08:18 -0800
Re: Implicit String-Literal Concatenation Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-02-29 18:17 +0100
Re: Implicit String-Literal Concatenation Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-02-29 09:22 -0800
Re: Implicit String-Literal Concatenation Kaz Kylheku <433-929-6894@kylheku.com> - 2024-02-29 19:26 +0000
Re: Implicit String-Literal Concatenation James Kuyper <jameskuyper@alumni.caltech.edu> - 2024-02-29 14:45 -0500
Re: Implicit String-Literal Concatenation Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-02-28 13:41 -0800
Re: Implicit String-Literal Concatenation Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-02-28 13:57 -0800
Re: Implicit String-Literal Concatenation bart <bc@freeuk.com> - 2024-02-28 23:01 +0000
Re: Implicit String-Literal Concatenation Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-02-28 15:31 -0800
Re: Implicit String-Literal Concatenation bart <bc@freeuk.com> - 2024-02-29 00:47 +0000
Re: Implicit String-Literal Concatenation Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-02-28 17:12 -0800
Re: Implicit String-Literal Concatenation tTh <tth@none.invalid> - 2024-02-29 16:29 +0100
Re: Implicit String-Literal Concatenation scott@slp53.sl.home (Scott Lurndal) - 2024-02-29 16:15 +0000
Re: Implicit String-Literal Concatenation scott@slp53.sl.home (Scott Lurndal) - 2024-02-29 15:53 +0000
Re: Implicit String-Literal Concatenation Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-02-29 09:06 -0800
Re: Implicit String-Literal Concatenation scott@slp53.sl.home (Scott Lurndal) - 2024-02-29 17:28 +0000
Re: Implicit String-Literal Concatenation David Brown <david.brown@hesbynett.no> - 2024-02-29 18:58 +0100
Re: Implicit String-Literal Concatenation scott@slp53.sl.home (Scott Lurndal) - 2024-02-29 18:05 +0000
Re: Implicit String-Literal Concatenation scott@slp53.sl.home (Scott Lurndal) - 2024-02-29 18:09 +0000
Re: Implicit String-Literal Concatenation Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-02-29 21:27 +0000
Re: Implicit String-Literal Concatenation bart <bc@freeuk.com> - 2024-03-01 11:52 +0000
Re: Implicit String-Literal Concatenation Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-03-05 04:47 +0000
Re: Implicit String-Literal Concatenation scott@slp53.sl.home (Scott Lurndal) - 2024-03-05 15:09 +0000
Re: Implicit String-Literal Concatenation Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-03-06 01:49 +0000
Re: Implicit String-Literal Concatenation David Brown <david.brown@hesbynett.no> - 2024-02-29 20:51 +0100
Re: Implicit String-Literal Concatenation David Brown <david.brown@hesbynett.no> - 2024-02-29 10:10 +0100
Re: Implicit String-Literal Concatenation bart <bc@freeuk.com> - 2024-02-29 10:18 +0000
Re: Implicit String-Literal Concatenation tTh <tth@none.invalid> - 2024-02-29 16:34 +0100
Re: Implicit String-Literal Concatenation bart <bc@freeuk.com> - 2024-03-01 11:58 +0000
Re: Implicit String-Literal Concatenation David Brown <david.brown@hesbynett.no> - 2024-03-01 13:17 +0100
Re: Implicit String-Literal Concatenation Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-02-29 09:03 -0800
Re: Implicit String-Literal Concatenation David Brown <david.brown@hesbynett.no> - 2024-02-29 19:08 +0100
Page 2 of 6 — ← Prev page 1 [2] 3 4 5 6 Next page →
| From | Kaz Kylheku <433-929-6894@kylheku.com> |
|---|---|
| Date | 2024-02-28 01:09 +0000 |
| Message-ID | <20240227170925.837@kylheku.com> |
| In reply to | #383121 |
On 2024-02-27, Lawrence D'Oliveiro <ldo@nz.invalid> wrote: > On Tue, 27 Feb 2024 23:21:28 +0100, David Brown wrote: > >> The #embed pre-processor directive turns the file into a list of integer >> constants, one per byte (unless an implementation offers other options). > > What a waste of time. Plus easily doable in 1970's Lisp. -- TXR Programming Language: http://nongnu.org/txr Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal Mastodon: @Kazinator@mstdn.ca
[toc] | [prev] | [next] | [standalone]
| From | David Brown <david.brown@hesbynett.no> |
|---|---|
| Date | 2024-02-28 12:50 +0100 |
| Message-ID | <urn6li$3s62i$1@dont-email.me> |
| In reply to | #383129 |
On 28/02/2024 02:09, Kaz Kylheku wrote: > On 2024-02-27, Lawrence D'Oliveiro <ldo@nz.invalid> wrote: >> On Tue, 27 Feb 2024 23:21:28 +0100, David Brown wrote: >> >>> The #embed pre-processor directive turns the file into a list of integer >>> constants, one per byte (unless an implementation offers other options). >> >> What a waste of time. > > Plus easily doable in 1970's Lisp. > That would be useful, if we were living in the 1970's or if anyone had wanted to learn Lisp this side of the millennium bug. As I mentioned before, it's not particularly difficult to do this kind of manipulation, and people write utilities for them in a variety of languages, or download a variety of free tools for the job. But it will often be more convenient to have it built into the language and compiler. And for those interested in speed, the test implementations have handled this far more efficiently than other techniques. Logically, #embed turns the file into a list of numbers. In practice, if you use it for the common case of initialising a const array of unsigned char, the compiler simply copies and pastes the file into the output as a binary blob. It would, IMHO, have been useful also to have had an "embed operator" in the manner of the "pragma operator", so that it could be used in a macro definition.
[toc] | [prev] | [next] | [standalone]
| From | Lawrence D'Oliveiro <ldo@nz.invalid> |
|---|---|
| Date | 2024-02-28 20:56 +0000 |
| Message-ID | <uro6ls$2mh1$5@dont-email.me> |
| In reply to | #383132 |
On Wed, 28 Feb 2024 12:50:10 +0100, David Brown wrote: > ... people write utilities for them in a variety of languages ... > > But it will often be more convenient to have it built into the language > and compiler. What can be built into the language can only ever be a small subset of the many and varied ways that people have incorporated data blobs into their programs. Often these will need to have custom structures with computed header fields, that kind of thing. So you will need custom build tools to construct these structures, and then you might as well include those blobs directly into the final build, rather than go through some extra step of pretending to turn them back into some source form. For example, here’s an old Android project of mine (OK, so the app is Java code, but the same principle applies) <https://bitbucket.org/ldo17/unicode_browser_android/src/master/> where I wrote a custom Python script to read a Nameslist.txt file downloaded from unicode.org to generate a table which could be loaded into memory quickly for easy searching.
[toc] | [prev] | [next] | [standalone]
| From | bart <bc@freeuk.com> |
|---|---|
| Date | 2024-02-28 21:34 +0000 |
| Message-ID | <uro8sl$3d71$1@dont-email.me> |
| In reply to | #383140 |
On 28/02/2024 20:56, Lawrence D'Oliveiro wrote:
> On Wed, 28 Feb 2024 12:50:10 +0100, David Brown wrote:
>
>> ... people write utilities for them in a variety of languages ...
>>
>> But it will often be more convenient to have it built into the language
>> and compiler.
>
> What can be built into the language can only ever be a small subset of
> the many and varied ways that people have incorporated data blobs into
> their programs. Often these will need to have custom structures with
> computed header fields, that kind of thing. So you will need custom
> build tools to construct these structures, and then you might as well
> include those blobs directly into the final build, rather than go
> through some extra step of pretending to turn them back into some
> source form.
>
> For example, here’s an old Android project of mine (OK, so the app is
> Java code, but the same principle applies)
> <https://bitbucket.org/ldo17/unicode_browser_android/src/master/>
> where I wrote a custom Python script to read a Nameslist.txt file
> downloaded from unicode.org to generate a table which could be loaded
> into memory quickly for easy searching.
I can see now where you get your coding style from. You seem to like
stretching things out vertically as much as possible:
public void Add
(
int CategoryCode,
ItemType Item
)
/* Use this instead of add to populate CodeToIndex table. */
{
CodeToIndex.put(CategoryCode, getCount());
add(Item);
} /*Add*/
In C:
void Add(int CategoryCode, ItemType Item) {
CodeToIndex_put(CategoryCode, getCount());
add(Item);
}
4 non-comment lines versus 9. I know Java needs tons of boilerplate, but
but it is not all the language's fault.
[toc] | [prev] | [next] | [standalone]
| From | Lawrence D'Oliveiro <ldo@nz.invalid> |
|---|---|
| Date | 2024-02-28 23:52 +0000 |
| Message-ID | <uroh0n$51an$2@dont-email.me> |
| In reply to | #383142 |
On Wed, 28 Feb 2024 21:34:14 +0000, bart wrote:
> In C:
>
> void Add(int CategoryCode, ItemType Item) {
> CodeToIndex_put(CategoryCode, getCount());
> add(Item);
> }
>
> 4 non-comment lines versus 9. I know Java needs tons of boilerplate, but
> but it is not all the language's fault.
Or how about
void Add(int CategoryCode, ItemType Item) {CodeToIndex_put(CategoryCode, getCount());add(Item);}
Wow! I never realized you could do that in C!! I thought it was an
error to put stuff after column 72 or something. Thanks for the tip!!!
[toc] | [prev] | [next] | [standalone]
| From | bart <bc@freeuk.com> |
|---|---|
| Date | 2024-02-29 00:15 +0000 |
| Message-ID | <uroial$58n9$1@dont-email.me> |
| In reply to | #383151 |
On 28/02/2024 23:52, Lawrence D'Oliveiro wrote:
> On Wed, 28 Feb 2024 21:34:14 +0000, bart wrote:
>
>> In C:
>>
>> void Add(int CategoryCode, ItemType Item) {
>> CodeToIndex_put(CategoryCode, getCount());
>> add(Item);
>> }
>>
>> 4 non-comment lines versus 9. I know Java needs tons of boilerplate, but
>> but it is not all the language's fault.
>
> Or how about
>
> void Add(int CategoryCode, ItemType Item) {CodeToIndex_put(CategoryCode, getCount());add(Item);}
>
> Wow! I never realized you could do that in C!! I thought it was an
> error to put stuff after column 72 or something. Thanks for the tip!!!
Well, you could write an entire program on one line.
Or you can write an entire program in one thin column:
v\
o\
i\
d\
....
Or you can use common sense and avoiding writing code which is either
too compact or so spread out vertically that you have to hunt for the
actual code. Like trying to find the bits of meat in a thin soup.
That's what I took away from your Java code, which looks remarkably like
the spaced-out examples you posted recently.
[toc] | [prev] | [next] | [standalone]
| From | Lawrence D'Oliveiro <ldo@nz.invalid> |
|---|---|
| Date | 2024-02-29 02:53 +0000 |
| Message-ID | <urorjd$ahe2$2@dont-email.me> |
| In reply to | #383152 |
On Thu, 29 Feb 2024 00:15:17 +0000, bart wrote:
> Or you can use common sense and avoiding writing code which is either
> too compact or so spread out vertically that you have to hunt for the
> actual code. Like trying to find the bits of meat in a thin soup.
Terribly sorry about that. I wonder if you could look at this part of the
same code file:
final android.util.SparseArray<Integer> CodeToIndex =
new android.util.SparseArray<Integer>();
and show me how to thicken that part of my humble, tasteless gruel? Maybe
using that same “_” trick you used to do OO in C in your previous example?
[toc] | [prev] | [next] | [standalone]
| From | bart <bc@freeuk.com> |
|---|---|
| Date | 2024-02-29 09:20 +0000 |
| Message-ID | <urpi8u$eo9h$1@dont-email.me> |
| In reply to | #383155 |
On 29/02/2024 02:53, Lawrence D'Oliveiro wrote: > On Thu, 29 Feb 2024 00:15:17 +0000, bart wrote: > >> Or you can use common sense and avoiding writing code which is either >> too compact or so spread out vertically that you have to hunt for the >> actual code. Like trying to find the bits of meat in a thin soup. > > Terribly sorry about that. I wonder if you could look at this part of the > same code file: > > final android.util.SparseArray<Integer> CodeToIndex = > new android.util.SparseArray<Integer>(); > > and show me how to thicken that part of my humble, tasteless gruel? Maybe > using that same “_” trick you used to do OO in C in your previous example? You've shown an example of a piece of meat. In main.java, 70% of the lines are either blanks or contain only an opening or closing bracket.
[toc] | [prev] | [next] | [standalone]
| From | scott@slp53.sl.home (Scott Lurndal) |
|---|---|
| Date | 2024-02-29 15:48 +0000 |
| Message-ID | <DH1EN.511038$xHn7.241242@fx14.iad> |
| In reply to | #383152 |
bart <bc@freeuk.com> writes:
>On 28/02/2024 23:52, Lawrence D'Oliveiro wrote:
>> On Wed, 28 Feb 2024 21:34:14 +0000, bart wrote:
>>
>>> In C:
>>>
>>> void Add(int CategoryCode, ItemType Item) {
>>> CodeToIndex_put(CategoryCode, getCount());
>>> add(Item);
>>> }
>>>
>>> 4 non-comment lines versus 9. I know Java needs tons of boilerplate, but
>>> but it is not all the language's fault.
>>
>> Or how about
>>
>> void Add(int CategoryCode, ItemType Item) {CodeToIndex_put(CategoryCode, getCount());add(Item);}
>>
>> Wow! I never realized you could do that in C!! I thought it was an
>> error to put stuff after column 72 or something. Thanks for the tip!!!
>
>Well, you could write an entire program on one line.
int main(int b,char**i){long long n=B,a=I^n,r=(a/b&a)>>4,y=atoi(*++i),_=(((a^n/b)*(y>>T)|y>>S)&r)|(a^r);printf("%.8s\n",(char*)&_);}
(A winner from the obfuscated C contest).
[toc] | [prev] | [next] | [standalone]
| From | Janis Papanagnou <janis_papanagnou+ng@hotmail.com> |
|---|---|
| Date | 2024-02-29 17:03 +0100 |
| Message-ID | <urq9st$mfrd$1@dont-email.me> |
| In reply to | #383170 |
On 29.02.2024 16:48, Scott Lurndal wrote:
>
> int main(int b,char**i){long long n=B,a=I^n,r=(a/b&a)>>4,y=atoi(*++i),_=(((a^n/b)*(y>>T)|y>>S)&r)|(a^r);printf("%.8s\n",(char*)&_);}
What does it do?
What preconditions must be fulfilled or what additions
does it need to compile?
>
> (A winner from the obfuscated C contest).
(Are non-compiling C sources allowed in the contest?)
Janis
[toc] | [prev] | [next] | [standalone]
| From | scott@slp53.sl.home (Scott Lurndal) |
|---|---|
| Date | 2024-02-29 16:17 +0000 |
| Message-ID | <I62EN.21987$hN14.16206@fx17.iad> |
| In reply to | #383173 |
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>On 29.02.2024 16:48, Scott Lurndal wrote:
>>
>> int main(int b,char**i){long long n=B,a=I^n,r=(a/b&a)>>4,y=atoi(*++i),_=(((a^n/b)*(y>>T)|y>>S)&r)|(a^r);printf("%.8s\n",(char*)&_);}
>
>What does it do?
>
>What preconditions must be fulfilled or what additions
>does it need to compile?
>
>>
>> (A winner from the obfuscated C contest).
>
>(Are non-compiling C sources allowed in the contest?)
https://www.ioccc.org/years.html
The above is from 'burton'.
[toc] | [prev] | [next] | [standalone]
| From | Janis Papanagnou <janis_papanagnou+ng@hotmail.com> |
|---|---|
| Date | 2024-02-29 18:12 +0100 |
| Message-ID | <urqdtl$nbj3$1@dont-email.me> |
| In reply to | #383176 |
On 29.02.2024 17:17, Scott Lurndal wrote:
> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>> On 29.02.2024 16:48, Scott Lurndal wrote:
>>>
>>> int main(int b,char**i){long long n=B,a=I^n,r=(a/b&a)>>4,y=atoi(*++i),_=(((a^n/b)*(y>>T)|y>>S)&r)|(a^r);printf("%.8s\n",(char*)&_);}
>>
>> What does it do?
>>
>> What preconditions must be fulfilled or what additions
>> does it need to compile?
With the link below I see it "needs" a 600+ lines long Makefile.
And I see there's some variable definitions with magic numbers
passed.
>>
>>>
>>> (A winner from the obfuscated C contest).
>>
>> (Are non-compiling C sources allowed in the contest?)
>
> https://www.ioccc.org/years.html
>
> The above is from 'burton'.
Thanks.
Janis
[toc] | [prev] | [next] | [standalone]
| From | scott@slp53.sl.home (Scott Lurndal) |
|---|---|
| Date | 2024-02-29 17:30 +0000 |
| Message-ID | <sa3EN.22761$zF_1.16954@fx18.iad> |
| In reply to | #383181 |
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>On 29.02.2024 17:17, Scott Lurndal wrote:
>> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>>> On 29.02.2024 16:48, Scott Lurndal wrote:
>>>>
>>>> int main(int b,char**i){long long n=B,a=I^n,r=(a/b&a)>>4,y=atoi(*++i),_=(((a^n/b)*(y>>T)|y>>S)&r)|(a^r);printf("%.8s\n",(char*)&_);}
>>>
>>> What does it do?
>>>
>>> What preconditions must be fulfilled or what additions
>>> does it need to compile?
>
>With the link below I see it "needs" a 600+ lines long Makefile.
The readme simply says compile it and run it
as ./prog <value between 1 and 512>.
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
|---|---|
| Date | 2024-02-29 13:20 -0800 |
| Message-ID | <87sf1brmr0.fsf@nosuchdomain.example.com> |
| In reply to | #383186 |
scott@slp53.sl.home (Scott Lurndal) writes:
> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>>On 29.02.2024 17:17, Scott Lurndal wrote:
>>> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>>>> On 29.02.2024 16:48, Scott Lurndal wrote:
>>>>>
>>>>> int main(int b,char**i){long long n=B,a=I^n,r=(a/b&a)>>4,y=atoi(*++i),_=(((a^n/b)*(y>>T)|y>>S)&r)|(a^r);printf("%.8s\n",(char*)&_);}
>>>>
>>>> What does it do?
>>>>
>>>> What preconditions must be fulfilled or what additions
>>>> does it need to compile?
>>
>>With the link below I see it "needs" a 600+ lines long Makefile.
>
> The readme simply says compile it and run it
> as ./prog <value between 1 and 512>.
No, you have to compile it with specific command-line arguments to
define B and I. The Makefile does that (don't ask me why it's so long),
but you can do it manually.
From hint.txt:
"""
On a little-endian machine:
clang -include stdio.h -include stdlib.h -Wall -Weverything -pedantic -DB=6945503773712347754LL -DI=5859838231191962459LL -DT=0 -DS=7 -o prog prog.c
On a big-endian machine:
clang -include stdio.h -include stdlib.h -Wall -Weverything -pedantic -DB=7091606191627001958LL -DI=6006468689561538903LL -DT=1 -DS=0 -o prog.be prog.c
"""
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */
[toc] | [prev] | [next] | [standalone]
| From | bart <bc@freeuk.com> |
|---|---|
| Date | 2024-02-29 21:44 +0000 |
| Message-ID | <urqtrj$qjp1$1@dont-email.me> |
| In reply to | #383197 |
On 29/02/2024 21:20, Keith Thompson wrote:
> scott@slp53.sl.home (Scott Lurndal) writes:
>> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>>> On 29.02.2024 17:17, Scott Lurndal wrote:
>>>> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>>>>> On 29.02.2024 16:48, Scott Lurndal wrote:
>>>>>>
>>>>>> int main(int b,char**i){long long n=B,a=I^n,r=(a/b&a)>>4,y=atoi(*++i),_=(((a^n/b)*(y>>T)|y>>S)&r)|(a^r);printf("%.8s\n",(char*)&_);}
>>>>>
>>>>> What does it do?
>>>>>
>>>>> What preconditions must be fulfilled or what additions
>>>>> does it need to compile?
>>>
>>> With the link below I see it "needs" a 600+ lines long Makefile.
>>
>> The readme simply says compile it and run it
>> as ./prog <value between 1 and 512>.
>
> No, you have to compile it with specific command-line arguments to
> define B and I. The Makefile does that (don't ask me why it's so long),
> but you can do it manually.
>
> From hint.txt:
> """
> On a little-endian machine:
>
> clang -include stdio.h -include stdlib.h -Wall -Weverything -pedantic -DB=6945503773712347754LL -DI=5859838231191962459LL -DT=0 -DS=7 -o prog prog.c
>
> On a big-endian machine:
>
> clang -include stdio.h -include stdlib.h -Wall -Weverything -pedantic -DB=7091606191627001958LL -DI=6006468689561538903LL -DT=1 -DS=0 -o prog.be prog.c
> """
In't it cheating when half the program is part of the build
instructions? Here is a complete standalone program:
----------------
#include <stdio.h>
#include <stdlib.h>
#define B 6945503773712347754LL
#define I 5859838231191962459LL
#define T 0
#define S 7
int main(int b,char**i){long long
n=B,a=I^n,r=(a/b&a)>>4,y=atoi(*++i),_=(((a^n/b)*(y>>T)|y>>S)&r)|(a^r);printf("%.8s\n",(char*)&_);}
----------------
It's 261 bytes. The 'one-liner' that was posted was 134 bytes.
(It appears to print an input of 0 to 255 as binary.)
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
|---|---|
| Date | 2024-02-29 14:06 -0800 |
| Message-ID | <87frxbrklh.fsf@nosuchdomain.example.com> |
| In reply to | #383201 |
bart <bc@freeuk.com> writes:
[...]
> In't it cheating when half the program is part of the build
> instructions?
Apparently not. If it were, the judges of the IOCCC would not have
accepted it.
The most recent rules are here:
https://www.ioccc.org/2020/rules.txt
I have not studied them to verify that the entry in question obeys them,
but the judges know what they're doing.
One of the winners of the 1988 contest was:
```
#include "/dev/tty"
```
This won a "Best Abuse of the Rules" award and resulted in a change in
the 1989 rules to forbid doing the same thing again.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */
[toc] | [prev] | [next] | [standalone]
| From | Janis Papanagnou <janis_papanagnou+ng@hotmail.com> |
|---|---|
| Date | 2024-03-01 18:09 +0100 |
| Message-ID | <urt23j$1bdeo$1@dont-email.me> |
| In reply to | #383205 |
On 29.02.2024 23:06, Keith Thompson wrote: > bart <bc@freeuk.com> writes: > [...] >> In't it cheating when half the program is part of the build >> instructions? I recall from decades ago (when I looked into this contest) that they even had a contribution that fed the whole C program into the compiler through compiler options. (I think it even got a prize.) "Is it cheating?" - I'd say no, since it was accepted. Is it really about an "obfuscated C code"? - I'd say no. (But it was anyway a curiosity.) > > Apparently not. If it were, the judges of the IOCCC would not have > accepted it. > [...] > > One of the winners of the 1988 contest was: > ``` > #include "/dev/tty" This is great! :-) Janis
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
|---|---|
| Date | 2024-03-01 10:49 -0800 |
| Message-ID | <87y1b1rdmd.fsf@nosuchdomain.example.com> |
| In reply to | #383222 |
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
> On 29.02.2024 23:06, Keith Thompson wrote:
>> bart <bc@freeuk.com> writes:
>> [...]
>>> In't it cheating when half the program is part of the build
>>> instructions?
>
> I recall from decades ago (when I looked into this contest) that they
> even had a contribution that fed the whole C program into the compiler
> through compiler options. (I think it even got a prize.)
1990/stig.c:
```
c
```
stig.ksh provides a ksh alias that compiles it with a long "-D..."
option. (The resulting program prints a message indicating whether the
compiler supports nested /**/ comments.)
Like most Abuse of the Rules winners, it resulted in a rule change for
the following years.
https://www.ioccc.org/years.html#1990
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */
[toc] | [prev] | [next] | [standalone]
| From | Janis Papanagnou <janis_papanagnou+ng@hotmail.com> |
|---|---|
| Date | 2024-03-01 22:06 +0100 |
| Message-ID | <urtfvr$1eg6j$2@dont-email.me> |
| In reply to | #383227 |
On 01.03.2024 19:49, Keith Thompson wrote: > > Like most Abuse of the Rules winners, it resulted in a rule change for > the following years. Makes sense. Janis
[toc] | [prev] | [next] | [standalone]
| From | Keith Thompson <Keith.S.Thompson+u@gmail.com> |
|---|---|
| Date | 2024-02-29 09:20 -0800 |
| Message-ID | <871q8vtcfh.fsf@nosuchdomain.example.com> |
| In reply to | #383176 |
scott@slp53.sl.home (Scott Lurndal) writes:
> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>>On 29.02.2024 16:48, Scott Lurndal wrote:
>>>
>>> int main(int b,char**i){long long n=B,a=I^n,r=(a/b&a)>>4,y=atoi(*++i),_=(((a^n/b)*(y>>T)|y>>S)&r)|(a^r);printf("%.8s\n",(char*)&_);}
>>
>>What does it do?
>>
>>What preconditions must be fulfilled or what additions
>>does it need to compile?
>>
>>>
>>> (A winner from the obfuscated C contest).
>>
>>(Are non-compiling C sources allowed in the contest?)
>
> https://www.ioccc.org/years.html
>
> The above is from 'burton'.
"burton" has submitted a number of entries over the years. This one is
https://www.ioccc.org/2020/burton/index.html
The program by itself does not compile. The provided Makefile passes
additional arguments, with B and I being defined differently in
big-endian vs. little-endian machines.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Medtronic
void Void(void) { Void(); } /* The recursive call of the void */
[toc] | [prev] | [next] | [standalone]
Page 2 of 6 — ← Prev page 1 [2] 3 4 5 6 Next page →
Back to top | Article view | comp.lang.c
csiph-web