[gdal-dev] Hungarian Notation

Laurențiu Nicola lnicola at dend.ro
Wed Apr 17 06:59:14 PDT 2024


Hi Andrew,

I think GDAL uses a mix of styles, but if you dislike Hungarian notation, it's still important to distinguish between "systems" (e.g. dwBytes) and "apps" (e.g. cchWideChar) notation.

The first one just repeats the variable type, which is mostly redundant, but the second actually gives you more information. Is that variable counting bytes, elements, or characters? Is it a NULL-terminated string, or a byte bufer with an associated length?

If you look at https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-widechartomultibyte, you'll see how Hungarian notation makes it easy (assuming you're used to it) to understand what cchWideChar and cbMultiByte mean, even though both are int.

Laurentiu

On Wed, Apr 17, 2024, at 16:48, Andrew Bell via gdal-dev wrote:
> Hi,
> 
> I was going to make some changes to some GDAL code and I generally want to follow along. I see that most of the code is still using Hungarian notation for identifier names. I haven't seen this anywhere else in like 20 years.
> 
> Is it OK to submit code without this naming convention or do we still think it's important. I didn't see an RFC or documentation that covers this, but there's lots so I may have missed it.
> 
> Thanks,
> 
> --
> Andrew Bell
> andrew.bell.ia at gmail.com
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20240417/8adb2d75/attachment.htm>


More information about the gdal-dev mailing list