unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master 97400c4c24: Make printing mostly non-recursive (bug#55481)
       [not found] ` <20220518090526.4AA10C009A8@vcs2.savannah.gnu.org>
@ 2022-05-18  9:55   ` Po Lu
  2022-05-18 14:40     ` Mattias Engdegård
  0 siblings, 1 reply; 3+ messages in thread
From: Po Lu @ 2022-05-18  9:55 UTC (permalink / raw)
  To: emacs-devel; +Cc: Mattias Engdegård

Mattias Engdegård <mattiase@acm.org> writes:

> +struct print_pp_entry {
> +  ptrdiff_t n;			/* number of values, or 0 if a single value */
> +  union {
> +    Lisp_Object value;		/* when n = 0 */
> +    Lisp_Object *values;	/* when n > 0 */
> +  } u;
> +};
> +
> +struct print_pp_stack {
> +  struct print_pp_entry *stack;	 /* base of stack */
> +  ptrdiff_t size;		 /* allocated size in entries */
> +  ptrdiff_t sp;			 /* current number of entries */
> +};

Thanks; however, I think our coding style is to put the opening brace of
structs, enums and unions on column 1, so this should be:

> +struct print_pp_entry
> +{
> +  ptrdiff_t n;			/* number of values, or 0 if a single value */
> +  union
> +  {
> +    Lisp_Object value;		/* when n = 0 */
> +    Lisp_Object *values;	/* when n > 0 */
> +  } u;
> +};
> +
> +struct print_pp_stack
> +{
> +  struct print_pp_entry *stack;	 /* base of stack */
> +  ptrdiff_t size;		 /* allocated size in entries */
> +  ptrdiff_t sp;			 /* current number of entries */
> +};

Instead.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: master 97400c4c24: Make printing mostly non-recursive (bug#55481)
  2022-05-18  9:55   ` master 97400c4c24: Make printing mostly non-recursive (bug#55481) Po Lu
@ 2022-05-18 14:40     ` Mattias Engdegård
  2022-05-19  1:09       ` Po Lu
  0 siblings, 1 reply; 3+ messages in thread
From: Mattias Engdegård @ 2022-05-18 14:40 UTC (permalink / raw)
  To: Po Lu; +Cc: emacs-devel

18 maj 2022 kl. 11.55 skrev Po Lu <luangruo@yahoo.com>:

>  I think our coding style is to put the opening brace of
> structs, enums and unions on column 1

I wasn't sure and there appeared to be considerable variation in the existing source (almost 300 cases of bracket on the same line, against 500-something with the bracket on a separate line), so I went with the former since it is more economic in vertical space without worsening readability.

Naturally I'll change if that is important, but then there's a lot of code to change, and apparently there is no clear consensus among previous authors.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: master 97400c4c24: Make printing mostly non-recursive (bug#55481)
  2022-05-18 14:40     ` Mattias Engdegård
@ 2022-05-19  1:09       ` Po Lu
  0 siblings, 0 replies; 3+ messages in thread
From: Po Lu @ 2022-05-19  1:09 UTC (permalink / raw)
  To: Mattias Engdegård; +Cc: emacs-devel

Mattias Engdegård <mattiase@acm.org> writes:

> I wasn't sure and there appeared to be considerable variation in the
> existing source (almost 300 cases of bracket on the same line, against
> 500-something with the bracket on a separate line), so I went with the
> former since it is more economic in vertical space without worsening
> readability.

Unfortunately, that contradicts our own coding standards.

> Naturally I'll change if that is important, but then there's a lot of
> code to change, and apparently there is no clear consensus among
> previous authors.

All of that code is formatted incorrectly, but reformatting existing
code breaks various things, such as vc-annotate.  What I think is wrong
is to introduce new instances of the incorrect formatting (such as
here), since our coding standards say:

  For struct and enum types, likewise put the braces in column one,
  unless the whole contents fits on one line:

    struct foo
    {
      int a, b;
    }

  or

    struct foo { int a, b; }



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-19  1:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <165286472597.14890.11407291537527786185@vcs2.savannah.gnu.org>
     [not found] ` <20220518090526.4AA10C009A8@vcs2.savannah.gnu.org>
2022-05-18  9:55   ` master 97400c4c24: Make printing mostly non-recursive (bug#55481) Po Lu
2022-05-18 14:40     ` Mattias Engdegård
2022-05-19  1:09       ` Po Lu

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).