473,395 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Mixed case?

I'm totally new to C, so this is a question from a total newbie. I
know most people write the names in C with underscores,
as_in_this_name. But... is it also customary to write them in mixed
case, asWithThisName? Or is it a horrible horrible horrible thing to
do??
Jun 27 '08 #1
9 1868
On Apr 30, 8:59*pm, s0s...@gmail.com wrote:
I'm totally new to C, so this is a question from a total newbie. I
know most people write the names in C with underscores,
as_in_this_name. But... is it also customary to write them in mixed
case, asWithThisName? Or is it a horrible horrible horrible thing to
do??
IMHO, it is a horrible thing to do. Unless you are german... ;-)
Jun 27 '08 #2
On Apr 30, 2:59 pm, s0s...@gmail.com wrote:
I'm totally new to C, so this is a question from a total newbie. I
know most people write the names in C with underscores,
as_in_this_name. But... is it also customary to write them in mixed
case, asWithThisName? Or is it a horrible horrible horrible thing to
do??
There's no *technical* issue with using mixed case, and it appears to
be the more popular style where I've worked; I prefer it myself (more
natural typing than adding a bunch of underscores).
Jun 27 '08 #3
s0****@gmail.com wrote:
I'm totally new to C, so this is a question from a total newbie. I
know most people write the names in C with underscores,
as_in_this_name. But... is it also customary to write them in mixed
case, asWithThisName? Or is it a horrible horrible horrible thing to
do??
So-called "camel-case" isn't as traditional in C. I've seen in more
often in C++. That being said, when I worked on a major project at my
company in the mid-90s, the coding standard mandated camel-case rather
than underscores. It doesn't really matter to me in writing or reading
code which one is used. It's another case where consistency is probably
more important.

Brian
Jun 27 '08 #4
s0****@gmail.com wrote:
I'm totally new to C, so this is a question from a total newbie. I
know most people write the names in C with underscores,
as_in_this_name. But... is it also customary to write them in mixed
case, asWithThisName? Or is it a horrible horrible horrible thing to
do??
"Do what comes naturally." If you like under_scores, use
under_scores. If you like camelCase, use camelCase. If you
like thingsruntogether, runthingstogether. I'd encourage you,
as a beginner, to give all three styles (and others you may
find or invent) a try for a while, and see how it feels.

A few rules, though:

- If you're making changes to an existing program, use
that program's prevailing style. You may hate it, but
if you depart from it the other programmers will hate
you still more.

- Stick with one style throughout one program or library;
don't mix-and-match.

- Steer clear of "reserved identifiers." The C language
assigns meaning to some identifiers like printf, and
reserves the right to do so in the future with currently
unused identifiers like straphanger and isosceles. See
http://www.oakroadsystems.com/tech/c-predef.htm for a
list of some of these; it's out of date but will give
a useful heads-up.

- Most Of All: Do NOT!!! perpetuate that so-called
"Hungarian notation" abomination, a reasonable idea
that was twisted into a psychotic nightmare by weak-
brained enthusiasts.

--
Er*********@sun.com
Jun 27 '08 #5
s0****@gmail.com writes:
I'm totally new to C, so this is a question from a total newbie. I
know most people write the names in C with underscores,
as_in_this_name. But... is it also customary to write them in mixed
case, asWithThisName? Or is it a horrible horrible horrible thing to
do??
It's a personal preference issue. If you are working within an
existing collection of code that uses a given convention, then I
would advise sticking with that convention. If you are writing
your own code, then you can choose the convention that you
prefer.
--
"When I have to rely on inadequacy, I prefer it to be my own."
--Richard Heathfield
Jun 27 '08 #6
John Bode wrote:
On Apr 30, 2:59 pm, s0s...@gmail.com wrote:
>I'm totally new to C, so this is a question from a total newbie. I
know most people write the names in C with underscores,
as_in_this_name. But... is it also customary to write them in mixed
case, asWithThisName? Or is it a horrible horrible horrible thing to
do??

There's no *technical* issue with using mixed case, and it appears to
be the more popular style where I've worked; I prefer it myself (more
natural typing than adding a bunch of underscores).
CamelCase seems to have come from the C++ / Microsoft world in the last
decade or so. When I began programming, you justwrotewithoutspaces and
if you couldn't read them you were a wuss. I've seen_AllSorts of
lpszStupidConventions over the years tho.

--
Mark McIntyre

CLC FAQ <http://c-faq.com/>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>
Jun 27 '08 #7
Mark McIntyre wrote:

CamelCase seems to have come from the C++ / Microsoft world in the
last decade or so. When I began programming, you
justwrotewithoutspaces and if you couldn't read them you were a wuss.
I've seen_AllSorts of lpszStupidConventions over the years tho.

Well, in the old days you kept all those identifiers nice and short. If
people couldn't figure out what adjxref meant, then they weren't paying
attention. And that was the functions. Variables rarely needed to be
over three characters in length. "num" and "len" were good enough for
the pioneers, after all.


Brian
Jun 27 '08 #8
On Apr 30, 4:40 pm, Eric Sosman <Eric.Sos...@sun.comwrote:
- Most Of All: Do NOT!!! perpetuate that so-called
"Hungarian notation" abomination, a reasonable idea
that was twisted into a psychotic nightmare by weak-
brained enthusiasts.
Hear hear!

My previous job required Hungarian notation for all code, not just C,
but Java as well--which is even more ridiculous as Java is strongly
typed.

Jun 27 '08 #9
s0****@gmail.com wrote:
>
I'm totally new to C, so this is a question from a total newbie.
I know most people write the names in C with underscores,
as_in_this_name. But... is it also customary to write them in
mixed case, asWithThisName? Or is it a horrible horrible horrible
thing to do??
There is no problem with either technique. The problems arise if
you use leading '_' chars in names. And remember that there are
various reserved names (for the implementation).

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
** Posted from http://www.teranews.com **
Jun 27 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

46
by: James Harris | last post by:
Before I embark on a new long-term project I'd appreciate your advice on how to split up long names. I would like to keep the standards for command names the same as that for variable names....
8
by: Ted Miller | last post by:
Hi folks, I'm looking at moving a large base of C++ code to .Net under tight time constraints. The code runs in mission-critical environments, and I am extremely concerned about the loader lock...
8
by: Bern McCarty | last post by:
Is it at all possible to leverage mixed-mode assemblies from AppDomains other than the default AppDomain? Is there any means at all of doing this? Mixed-mode is incredibly convenient, but if I...
8
by: Nadav | last post by:
Hi, I am writing a performence critical application, this require me to stick to unmanaged C++ as performance is much better using unmanaged C++ ( about 33% better ), Still, I am trying to avoid...
3
by: Steve McLellan | last post by:
Hi, Sorry for the long post, it's a bit epic (and sums up the last 10 hours of my life, apart from my car's gearbox melting). We've got a mixed C++ assembly that's exhibiting odd behaviour...
0
by: samsonfr | last post by:
Hello, I have read KB 814472 and the article "How To: Remove Dependency on _vcclrit.h" (http://msdn2.microsoft.com/en-us/library/ms173267(en-us,vs.80).aspx) which confirmed that VS.NET 2005...
3
by: Mali Guven | last post by:
Hello, I have a native DLL (written in C) which is supposed to call a managed DLL (was written in C#, and an entry point was injected modifying the ildasm'd code). The exectuable calls the...
4
by: natG | last post by:
Hi; I am transferring data from MySql to db2 using my own java/jdbc program. Working out ok, except for the fact that our apps use mixed-case names for tables and columns. Although my CREATE TABLE...
0
by: emu | last post by:
Hi All, I have an unmanaged C++ application that references a mixed mode image DLL (mixed managed and unmanaged). Under .NET 1.1 we could trust the dll (the mixed mode dll) by running the...
5
by: NPotnis | last post by:
Hi , I am trying to host .Net UserControls in a MFC Application. The MFC Application is an ActiveX DLL. I inserted required managed code inside the MFC application, making it a mixed mode DLL....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.