Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which naming convention should I use for a struct? [closed]

In plain C, I will name a struct like this:

struct MyStruct
{
    int something;
};

But, since I'm now programming under Windows, I want my code to be very consistent in which refers to naming conventions. So, my variables are now named using mixedCase instead of lower_case and my functions are now using CapWords. I have seen some structs with all capital letters, but I don't like this very much because I reserve that for constants and macros.

Thanks.

like image 778
cdonts Avatar asked Jan 21 '14 22:01

cdonts


2 Answers

Check out this link if you want a reference on Naming Conventions in C.

As long as you're consistent with using CamelCase of under_score conventions for whatever purpose, it doesn't really matter.

What are the most common naming conventions in C?

like image 60
Seyon Avatar answered Sep 23 '22 14:09

Seyon


Here is a similar question: Naming convention for Win32/MFC with C++
MSDN naming guideline locates at http://msdn.microsoft.com/en-us/library/ms229002(v=vs.110).aspx
Struct naming convention is described at http://msdn.microsoft.com/en-us/library/ms229040(v=vs.110).aspx

like image 42
vad Avatar answered Sep 26 '22 14:09

vad