On Fri, 2 Jul 2021 15:09:42 +0959
Reuben ua Bríġ wrote:
> > Some languages do not have ternaries.
>
> in C:
> ternary EXPRESSION: A ? B : C
> ternary STATEMENT:if (A) B; else C;
>
> i will define some macros to highlight the similarity:
>
> […snip…]
>
> #define exif(e) e ?
>
On Thu, 1 Jul 2021 19:09:28 +1000
Reuben ua Bríġ wrote:
> > Date: Thu, 1 Jul 2021 13:51:21 +1000
> > From: Stuart Longland
>
> > Even someone who didn't know "C",
>
> ... seriously?
Yes seriously, there are people who write software computers, and do
not know C.
> > If you didn't know w
When you write code by yourself:
On Tue, Jun 29, 2021 at 6:15 AM Reuben ua Bríġ wrote:
> a style i came up with in imitation of some disgusting haskell code.
When you write code with others:
On Wed, Jun 30, 2021 at 7:34 AM Todd C. Miller wrote:
> It is because consistency makes the code
> easi
On Tue, 29 Jun 2021 15:17:58 +0959
Reuben ua Bríġ wrote:
> i found the following:
>
> if (strcmp(progname, BINM_MAN) == 0)
> search.argmode = ARG_NAME;
> else if (strcmp(progname, BINM_APROPOS) == 0)
> search.argmode = ARG_EXPR;
> else if (
The reason to a style guide is not that one style is inherently
better than another. It is because consistency makes the code
easier to read for anyone familiar with that style. Part of that
means using common idioms that are immediately recognizable by
someone familiar with the style. This redu
> Date: Wed, 30 Jun 2021 13:27:21 +1000
> From: Reuben ua Bríġ
> it seems a lot of people are having difficulty with my ?: expression.
>
> rather than going through each branch yourself, think of it like a
> `boolean' switch that stops on the first `true' question (the bit on
> each line before
heres a fun example i was an idiot to miss:
> Date: Tue, 29 Jun 2021 15:17:58 +0959
> From: Reuben ua Bríġ
> ANSI 'K'&'R' is really just 'B' in disguise.
/* note the () around & are for ==, not ?: */
int main() { return ('K'&'R') == 'B' ? 0 : 1; }
it seems a lot of people are having difficulty with my ?: expression.
rather than going through each branch yourself, think of it like a
`boolean' switch that stops on the first `true' question (the bit on
each line before the ?), and then chooses the corresponding `answer'
(the bit before the :).
Saying a code is horrible, is often subjective. If you work on your own
project, choose the style that fits your mind. If you are patching a program,
try to be consistent with the existing code.
You can also have a look at the “style” manpage but keep in mind that it is for
the kernel.
Ronan
you can use a formatter such use astyle or clang-format
On Tue, Jun 29, 2021 at 7:55 AM jslee wrote:
>
> On Tue, 29 Jun 2021, at 15:18, Reuben ua Bríġ wrote:
> > any comments?
>
> http://man.openbsd.org/style.9
>
> Yes, two comments
>
> 1. Read more / write less
>
> 2. Sharp deviations from widel
On Tue, 29 Jun 2021, at 15:18, Reuben ua Bríġ wrote:
> any comments?
http://man.openbsd.org/style.9
Yes, two comments
1. Read more / write less
2. Sharp deviations from widely-accepted style, such as multiply-nested
ternaries, make it harder for others to play in your codebase, with zero
tang
gday folks.
first i will say i am do not consider myself well versed in machine
languages. i have use plain tex for a while, and i use the odd bit of
sh, sed, etc. i recently read K&R because sh disgusts me. i have seen
a bit of some programming languages, but nothing very recent, and i
cant sa
12 matches
Mail list logo