Hello,
I've some code which I'd like to release in object form along with a
suitable header. Before I do this however, I'd like to finalise the
exact names for everything declared in the header, and want to make sure
that I make the right choice, both with regards readability and
following existing standards. I was wondering if there are any style
guides or what peoples opinions are on the following:
1) Everything declared starts with a unique identifier, e.g. xyz_. How
should this be capitalised, and how many trailing underscores. Two
existing examples are:
gd... and FLAC__...
2) At present, all my function are named along the lines of
xyz_do_somethin g(). The alternatives seems to be xyz_DoSomething or
xyz_doSomething , any precedent?
3) My typdefs are all similarly named, e.g. xyz_my_typdef. Is it
sensible to capitalise these to distinguish them?
4) Typedefs involving structs and the structs themselves are identically
named, e.g.
typdef struct xyz_a xyz_a;
// Later
struct xyz_a {
...
}
is this sensible?
Does anyone have any thoughts on the above, or is it all just down to
personal preference?
Regards,
Chris
Sep 17 '07
12 1789
Ian Collins said:
David Thompson wrote:
>On Mon, 17 Sep 2007 12:48:47 +0100, Christopher Key <cj***@cam.ac.u k> wrote:
>><snip: releasing codeI was wondering if there are any style guides or what peoples opinions are on the following:
1) Everything declared starts with a unique identifier, e.g. xyz_. How should this be capitalised, and how many trailing underscores. Two existing examples are:
gd... and FLAC__...
Double underscores are legal in C but not C++.
Says who?
Says ISO/IEC 14882:1998, which contains the following paragraph:
17.4.3.1.2 Global names [lib.global.name s]
1 Certain sets of names and function signatures are always reserved to
the implementation:
- Each name that contains a double underscore (_ _) or begins with an
underscore followed by an upper-case letter (2.11) is reserved to the
implementation for any use.
I suggest that it might be wiser to take further discussion of this
question to comp.lang.c++.
--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Chris Hills wrote:
>> I suggest that it might be wiser to take further discussion of this question to comp.lang.c++.
Here we go again... as soon as some one mentions C++ you run from it
like vampires from sun light.
I got this one wrong, it happens. There isn't anything left to say.
--
Ian Collins.
Chris Hills said:
In article <I7************ *************** ***@bt.com>, Richard Heathfield
<rj*@see.sig.in validwrites
<snip>
>>I suggest that it might be wiser to take further discussion of this question to comp.lang.c++.
Here we go again... as soon as some one mentions C++ you run from it
like vampires from sun light.
On the contrary, I answered the question fully, and provided appropriate
redirection, should the OP wish to check my answer with C++ experts. That
seems reasonable to me.
Chris, obviously disagreement and discussion are par for the course in
comp.lang.c, but recently it seems that your replies to my articles have
become hostile rather than merely disputational; several have been
childish; and one has been dishonest. I've tried very hard not to see you
as a troll, but I can no longer see how I can justify that.
I'll review the situation in 30 days.
--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: craig |
last post by:
I am curious about how many of you prefer style 1 vs. style 2, and why. Are
there names for these style?
style 1:
method {
}
|
by: Natt Serrasalmus |
last post by:
After years of operating without any coding standards whatsoever, the
company that I recently started working for has decided that it might be a
good idea to have some. I'm involved in this initiative.
Typically I find that coding standards are written by some guy in the
company who has a way of coding that he likes and then tries to force
everybody else to write code the way he likes it, not for any rational
reason, but simply for the...
|
by: Ron Burd |
last post by:
Hi,
As my company is moving into C# they are enforcing the use of styling
convention in the source code, such as methods naming conventions, newlines,
etc.
Does someone know of products that are good at this job? (free and/or
commercial)
|
by: Dotnetjunky |
last post by:
Hi,
So far, I've found tons of documents describing
recommended coding standards for C#, but not a single
piece on VB.NET yet.
Anybody here knows such a coding standards guideline on
VB.NET and minds sharing with us ?
Thanks in advance.
|
by: Mike Labosh |
last post by:
I realize that you people have not seen much of me other than some framework
responses I have posted.
I am primarily a VB guy (yes, you can laugh) But I have lurked here for
several years, picking up little crumbs of C# wisdom.
Perhaps it's just my style, but what's this annoying behavior of the IDE and
how do I stop it:
C# seems to want me to write all my code like this:
| |
by: benben |
last post by:
Is there an effort to unify the c++ coding standard? Especially
identifier naming.
Not a big issue but it would be annoying to have to incorporate
different coding styles simultaneously when using more than one library.
The standard library seems to have everything lower-cased while a lot of
other libraries do their own way.
Ben
|
by: ct-86 |
last post by:
http://www.cdbook.cn/book.asp?id=2393
Organizational and Policy Issues
1
0. Don't sweat the small stuff. (Or: Know what not to standardize.)
2
1. Compile cleanly at high warning levels.
4
2. Use an automated build system.
7
3. Use a version control system.
|
by: Robert Seacord |
last post by:
The CERT/CC has just deployed a new web site dedicated to developing
secure coding standards for the C programming language, C++, and
eventually other programming language.
We have already developed significant content for the C programming
language that is available at:
https://www.securecoding.cert.org/
by clicking on the "CERT C Programming Language Secure Coding Standard"
|
by: Jim Johnson |
last post by:
is this C style coding?
I don't seem to see much C++ code in this way.
is this a bad programming practice?
code seem ugly coding this way.
=================
|
by: MJ_India |
last post by:
Style 1:
struct my_struct
{
...
};
typedef my_struct my_struct_t;
Style 2:
typedef struct my_struct
{
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |