Re: valgrind leak I can't find

Liste des GroupesRevenir à cl c 
Sujet : Re: valgrind leak I can't find
De : segfault (at) *nospam* tilde.green (Annada Behera)
Groupes : comp.lang.c
Date : 22. Aug 2024, 14:01:42
Autres entêtes
Organisation : tilde.green
Message-ID : <1c5db75fd1fd3b0e61bd2517a38f2829d0aeee6c.camel@tilde.green>
References : 1 2 3
User-Agent : Evolution 3.52.2
On Thu, 2024-08-22 at 08:18 -0300, Thiago Adams wrote:
On 22/08/2024 08:01, Bart wrote:
On 22/08/2024 09:41, Mark Summerfield wrote:
 
This is the type's struct:
 
typedef struct {
     int _size;
     int _cap;
     char** _values;
} VecStr;
 
What's with the leading underscores for member names?
 
It means ending with ->_ later on, which seems pointless extra
clutter.
 
 
C++ is responsible for this.
 
C++ made the usage of 'this->' optional when calling member
functions.
 
As a result, when C++ programmers encounter 'i' in the middle of a
function, they might not know where it comes from.
 
If 'this->' were not optional, 'this->i' would clarify that.
 
To avoid confusion, many C++ programmers use prefixes like 'm_' that
can't be ignored.
 
Since many C programmers also work in C++, this pattern can sometimes
influence C code as well.

Although I think this is stupid thing to do when writing C, the same
convention also exits in Python PEP-8 [1]

    _single_leading_underscore: weak “internal use” indicator.
    E.g. from M import * does not import objects whose names start with
    an underscore.

[1]: https://peps.python.org/pep-0008/#descriptive-naming-styles


Date Sujet#  Auteur
22 Aug 24 * valgrind leak I can't find26Mark Summerfield
22 Aug 24 +- Re: valgrind leak I can't find1Ben Bacarisse
22 Aug 24 +* Re: valgrind leak I can't find11Bart
22 Aug 24 i`* Re: valgrind leak I can't find10Thiago Adams
22 Aug 24 i `* Re: valgrind leak I can't find9Annada Behera
22 Aug 24 i  +* Naming conventions (was Re: valgrind leak I can't find)6Janis Papanagnou
22 Aug 24 i  i`* Re: Naming conventions (was Re: valgrind leak I can't find)5Thiago Adams
23 Aug 24 i  i +- Re: Naming conventions (was Re: valgrind leak I can't find)1Janis Papanagnou
23 Aug 24 i  i `* Re: Naming conventions (was Re: valgrind leak I can't find)3James Kuyper
25 Aug 24 i  i  `* Re: Naming conventions (was Re: valgrind leak I can't find)2Janis Papanagnou
26 Aug 24 i  i   `- Re: Naming conventions (was Re: valgrind leak I can't find)1James Kuyper
24 Aug 24 i  `* Re: valgrind leak I can't find2Blue-Maned_Hawk
24 Aug 24 i   `- Re: valgrind leak I can't find1Keith Thompson
22 Aug 24 +- Re: valgrind leak I can't find1Stefan Ram
22 Aug 24 +- Re: valgrind leak I can't find1Ike Naar
22 Aug 24 +- Re: valgrind leak I can't find1Stefan Ram
22 Aug 24 +- Re: valgrind leak I can't find1Kaz Kylheku
22 Aug 24 `* Re: valgrind leak I can't find9Mark Summerfield
22 Aug 24  +- Re: valgrind leak I can't find1Kaz Kylheku
23 Aug 24  +* Re: valgrind leak I can't find6Stefan Ram
23 Aug 24  i`* Re: valgrind leak I can't find5Bart
23 Aug 24  i `* Re: valgrind leak I can't find4Michael S
23 Aug 24  i  +* Re: valgrind leak I can't find2James Kuyper
23 Aug 24  i  i`- Re: valgrind leak I can't find1James Kuyper
23 Aug 24  i  `- Re: valgrind leak I can't find1David Brown
23 Aug 24  `- Re: valgrind leak I can't find1James Kuyper

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal