473,796 Members | 2,798 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1896
On Apr 30, 8:59*pm, s0s...@gmail.co m 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.co m 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.co m 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.co m 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 thingsruntogeth er, runthingstogeth er. 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.co m 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.co m 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_nam e. 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 justwrotewithou tspaces and
if you couldn't read them you were a wuss. I've seen_AllSorts of
lpszStupidConve ntions 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
justwrotewithou tspaces and if you couldn't read them you were a wuss.
I've seen_AllSorts of lpszStupidConve ntions 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...@su n.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.co m 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
2741
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. Looking at the examples below, which ones seem better? Straight names echoclient lastcharoffset helloworld Internal underscores
8
4526
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 problem and the potential for deadlocks. After pouring over the available information, and trying a few experiments, I am still left with a few questions and issues I hope someone out there can shed some light on.
8
3517
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 cannot load/unload/reload extensions into my large and slow-to-load application during development without restarting the process then the disadvantages may outweigh the advantages. I've got a mixed-mode program in which I create a new AppDomain...
8
2000
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 the usage of old style COM, my alternative is to expose my unmanaged interface through the CLI, to achieve that I have created a mixed mode DLL in which my unmanaged class are defined. When referencing the DLL just described in another mixed mode EXE...
3
1566
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 when the /OPT:REF (remove unreferenced data) linker option is set. We first noticed the problem after removing the /DEBUG option (which silently alters the defaults for the /OPT option) and assumed that was the cause for a few hours until I read the...
0
1479
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 don't need the "/noentry + MSVCRT.LIB + __DllMainCRTStartup@12 + __crt_dll_initialize, and __crt_dll_terminate" fix anymore ... I used the article "How to: Compile MFC and ATL Code with /clr"
3
2786
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 native DLL but the native DLL fails to load the managed DLL. The paper that addresses the 'mixed DLL problem' below does not offer any understandable workaround....
4
10300
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 commands issued via jdbc uses mixed case for the names, db2 insists on using only upper case. (This also happens from the CLP or DB2CC, but my concern is for it to work via jdbc.) Is there a simple setting at the database level to allow mixed...
0
3003
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 following command line: caspol.exe -polchgprompt off -machine -addgroup 1 -url "file://<UNC path to dll>\mixedMode.dll" FullTrust ame "GroupName" -polchgprompt on
5
3193
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. I am following the KB article for mixed mode DLL's http://support.microsoft.com/?id=814472 I linked the DLL with /noentry option. Also I added and exported the DllEnsureInit and DllForceTerm methods in my DLL which call __crt_dll_initialize()...
0
9685
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9535
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,...
0
10244
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10201
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10021
tracyyun
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...
1
7558
isladogs
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...
0
6802
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();...
0
5454
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...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.