[PHP-DEV] Re: Local variables for editors

2019-01-19 Thread Peter Kokot
On Wed, 29 Nov 2017 at 22:53, Peter Kokot  wrote:
>
> Hello,
>
> I'm not sure if this has been discussed before, but I find these local
> variables in C, H and other files a bit strange and bloated:
>
> /*
>  * Local variables:
>  * tab-width: 4
>  * c-basic-offset: 4
>  * End:
>  * vim600: noet sw=4 ts=4 fdm=marker
>  * vim<600: noet sw=4 ts=4
>  */
>
> Is there any chance to start omitting them and use a single
> .editorconfig file instead or is this something that is a must have in
> C projects of today?
>
> Thank you for some clarification on this :)

Hello, I'm bumping this question since it was brought up also in the
pull request for fixing the code style of the libmbfl [1].

Going through these editor settings:
- tab-width: 4 is already set in the .editorconfig file
- c-basic-offset: 4 is emacs setting for indentation level [2]
- noet is setting for vim to not expand tabs to spaces
- sw means setting the shift width in vim
- ts means tabstop
- fdm=marker means folding method [3]

Since these are specific for the C code, we should instead set other
ways of code style fixes methods for this task. For example, Clang
format and Clang tidy can fix existing code quite nicely from what the
settings they have available. And EditorConfig mostly can do all that
what is set above - set the indentation style and its width. Not to
mention that with the default Vim configuration (tested on latest
Ubuntu), this doesn't work as it should anymore.

So, the main question here, can we start removing these comment blocks
from the *.c and *.h files together with the footer file [4]?

[1] https://github.com/php/php-src/pull/3754
[2] https://www.emacswiki.org/emacs/IndentingC
[3] http://vim.wikia.com/wiki/Folding
[4] http://git.php.net/?p=php-src.git;a=blob;f=footer;hb=HEAD

--
Peter Kokot

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] Re: php-src code style

2019-01-19 Thread Legale Legage
Got it, thanks!

On Sat, 19 Jan 2019 at 15:49, Christoph M. Becker  wrote:

> On 19.01.2019 at 13:46, Legale Legage wrote:
>
> > Hello, internals.
> > I was trying to find code style guide for php-src project on the
> > wiki.php.net
> > The only thing i found:
> >
> > http://doc.php.net/tutorial/style.php
>
> This is about the documentation (aka. PHP manual).
>
> > Do we have a code style guide in the form of a document?
>
> See .
>
> --
> Christoph M. Becker
>


[PHP-DEV] Re: php-src code style

2019-01-19 Thread Christoph M. Becker
On 19.01.2019 at 13:46, Legale Legage wrote:

> Hello, internals.
> I was trying to find code style guide for php-src project on the
> wiki.php.net
> The only thing i found:
> 
> http://doc.php.net/tutorial/style.php

This is about the documentation (aka. PHP manual).

> Do we have a code style guide in the form of a document?

See .

-- 
Christoph M. Becker

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] php-src code style

2019-01-19 Thread Legale Legage
Hello, internals.
I was trying to find code style guide for php-src project on the
wiki.php.net
The only thing i found:

http://doc.php.net/tutorial/style.php

Do we have a code style guide in the form of a document?

Will it be ok if I use these parameters:

1. Encoding: utf-8 (without BOM)
2. Line separator: \n
3. Line width: 120 chars
4. If something doesn't fit on the line, then break the line and start on
the next one with a single indent relative to the indent of the current
code block.
Example:
function fun(int a, int b, int c,
int d)

5. Сommas, colons, question marks etc remain on the broken line. Example:
c = (a == b) ?
1 :
2;

char a[] = {
1, 2, 3, 4, 5, 6,
7, 8, 9, 10, 11,
};