Sujet : Re: valgrind leak I can't find
De : thiago.adams (at) *nospam* gmail.com (Thiago Adams)
Groupes : comp.lang.cDate : 22. Aug 2024, 12:18:30
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <va76q6$dljb$2@dont-email.me>
References : 1 2
User-Agent : Mozilla Thunderbird
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.