Re: Pull Request: Addition of String Data Type in /sys/sys/types.h

2023-06-18 Thread Scott Cheloha
> On Jun 18, 2023, at 02:19, Abderrahmane Ghellab 
>  wrote:
> 
> [...]
> 
> In my pull request , I made a
> simple modification to the file by adding a new line to introduce a string
> data type. Below, you can find the diff highlighting the changes made:
> 
> ```diff
> 4848   #endif
> 4949
> 5050   #if __BSD_VISIBLE
>51 + typedef char * string; /*String Data Type: Better than writing
> char* every time*/
> 5152typedef unsigned char u_char;
> 5253typedef unsigned short u_short;
> 5354typedef unsigned int u_int;
> ```
> 
> The addition of the `string` data type aims to enhance code readability and
> reduce verbosity. Instead of explicitly writing `char*` every time a string
> is declared, developers can now utilize the `string` type for convenience
> and brevity.
> 
> I believe that this modification can contribute positively to the OpenBSD
> codebase, simplifying code maintenance and making it more intuitive for
> developers. It aligns with the philosophy of OpenBSD to provide a secure,
> simple, and clean operating system.

this is a very high-quality troll, nice



Re: Pull Request: Addition of String Data Type in /sys/sys/types.h

2023-06-18 Thread Ingo Schwarze
Hi,

Abderrahmane Ghellab wrote on Sun, Jun 18, 2023 at 08:16:21AM +0100:

> I am writing to discuss a recent pull request I submitted

Never submit pull requests, for no reason whatsoever, full stop.
There is no excuse for doing that (except in a few related projects
like OpenSSH-portable).

> regarding the /sys/sys/types.h file.

As a general rule, don't add non-standard stuff to standard
headers:  is included by dozens of POSIX headers,
so you are inviting clashes and incompatibility issues in lots of
existing standard-compliant code.

Additions to standard headers require very robust justification.

> typedef char * string;
> /*String Data Type: Better than writing char* every time*/

This is completely ridiculous.  It is pure obfuscation.  Everybody
understands what char * means in C, nobody would know what a
user-defined data type "string" might be.  Besides, you are hiding
the fact that it is a pointer type.  In general, never typedef
"*" or "struct" away, it is valueable see them whenever the type
is used.  You are also making it harder for people to read the C
language standard and the POSIX standard because those will contonie
talking about char *, including in the official declarations of
function prototypes.  Arguing for brevity in something that is five
printable characters long and proposing a replacement that is also
five printable characters long is hilarious.  You are not even saving a
space character, "char *s" and "string s" are the exactly same length,
no matter whether you count whitespace or not.

There is no chance whatsoever of this, or anything similar, being
accepted.

Your main mistake is that you try to solve a problem where no
problem exists at all.

You severely harm clarity, readability, standards conformance,
and application code compatibility for no reason whatsoever.

> steps required from my end.

It you want to contribute, start by getting a better understanding
of the C programming language, of secure and standard compliant
programming practices, and of OpenBSD development goals and priorities.

Yours,
  Ingo