473,797 Members | 3,174 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Caps convention.

Use all lower case for ansi c functions, and Capitalise For
Platform-Specific.

If you call something with caps, then your function name requires caps
itself.

Nov 14 '05 #1
20 2014
On Sat, 20 Dec 2003 17:27:43 -0000, "Malcolm"
<ma*****@55bank .freeserve.co.u k> wrote in comp.lang.c:
Use all lower case for ansi c functions, and Capitalise For
Platform-Specific.

If you call something with caps, then your function name requires caps
itself.


No. Any you can't make me.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.l earn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
Nov 14 '05 #2
Malcolm wrote:
Use all lower case for ansi c functions, and Capitalise For
Platform-Specific.

If you call something with caps, then your function name requires caps
itself.


The common style is to use all-caps for constants and macros.
Function name styles differ:
leading word starts lowercase followed by Capitalized words:
thisIsMyFunctio n
same thing, using underscores:
this_Was_My_Fun ction
starting with Captials:
ThisIsAnotherFu nction
This_May_Be_Mor e_Readable
as you suggested:
anansicfunction
another_ansi_fu nction

However, most all good coding styles don't permit function names
to start with '_' (underscores) as these are reserved for
implementations .

This is a religous issue: all a matter of faith. As long as you
are consistent and the names are readble, any style will do. Just
as there is no best religion, there is no best coding style.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.l earn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
http://www.sgi.com/tech/stl -- Standard Template Library

Nov 14 '05 #3
Malcolm wrote:
Use all lower case for ansi c functions, and Capitalise For
Platform-Specific.

If you call something with caps, then your function name requires caps
itself.


Taken to its logical conclusion, this requires you to define your entry
point as Main() - and then it won't link.

Duh.

--
Richard Heathfield : bi****@eton.pow ernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 14 '05 #4
Thomas Matthews wrote:
Malcolm wrote:
Use all lower case for ansi c functions
and Capitalize For Platform-Specific.

If you call something with caps,
then your function name requires caps itself.

No!
That would imply that your API *depends* upon
details of its implementation.
The common style is to use all-caps for constants and macros.
This is an anachronism.
Function name styles differ:
leading word starts lowercase followed by Capitalized words:
thisIsMyFunctio n
same thing, using underscores:
this_Was_My_Fun ction
starting with Captials:
ThisIsAnotherFu nction
This_May_Be_Mor e_Readable
as you suggested:
anansicfunction
another_ansi_fu nction
These aren't really styles. The are typing shortcuts
for programmers with a missing shift key.
The idea was that because capital letters and underscore
required the programmer to hold down the shift key,
they slowed down typing (meaning productivity).
The first style above is a compromise
between readability and typing efficiency.
However, most all good coding styles
don't permit function names to start with '_' (underscores)
as these are reserved for implementations .
Again, this rule has nothing to do with style.
It's just a way to avoid conflicts with the implementation.
This is a religious issue: all a matter of faith.
As long as you are consistent and the names are readable,
any style will do.
Just as there is no best religion, there is no best coding style.


Yes, but no "true believer" will agree with you.

Nov 14 '05 #5

On Sat, 20 Dec 2003, Richard Heathfield wrote:

Malcolm wrote:

Use all lower case for [ANSI C] functions, and Capitalise For
Platform-Specific.

If you call something with caps, then your function name requires caps
itself.


Taken to its logical conclusion, this requires you to define your entry
point as Main() - and then it won't link.


Only if your main function is Platform-Specific. And in that case
it's off-topic for comp.lang.c anyway, and if you do post it,
*no matter* the capitalization, all you'll get are smiley posts
claiming that it won't link on [your OS here]. No harm, no foul.
(-:

FWIW, except for Malcolm's miscapitalizati on of the terms "ANSI C",
I basically agree with his statement. I just don't think it really
needed to be broadcast to the world, any more than it would be
appropriate to start a new thread in alt.usage.engli sh to say,
"Start a new paragraph when there's a new speaker," or in comp.programmin g
to point out that the worst-case running time of Quicksort is O(n^2).
Those who care, already know.

-Arthur
Nov 14 '05 #6
begin E. Robert Tisdale:
These aren't really styles. The are typing shortcuts
for programmers with a missing shift key.
The idea was that because capital letters and underscore
required the programmer to hold down the shift key,
they slowed down typing (meaning productivity).


And how do you get an underscore without pressing shift?

--
Für Google, Tux und GPL!
Nov 14 '05 #7

"Richard Heathfield" <do******@addre ss.co.uk.invali d> wrote in message
Taken to its logical conclusion, this requires you to define your entry
point as Main() - and then it won't link.

Duh.

So this is an issue for comp.std.c. If programs beginning main() were
constrained to be portable ANSI C, whilst platform-specific can start
Main(), then this is a powerful incentive for people to write portable
programs.

Actually main() is often not the entry point for non-ANSI programs.
Nov 14 '05 #8
Arthur J. O'Dwyer wrote:
On Sat, 20 Dec 2003, Richard Heathfield wrote:
Malcolm wrote:
>
> Use all lower case for [ANSI C] functions, and Capitalise For
> Platform-Specific.
>
> If you call something with caps, then your function name requires caps
> itself.
Taken to its logical conclusion, this requires you to define your entry
point as Main() - and then it won't link.


Only if your main function is Platform-Specific.


Or if it /calls/ something Platform-Specific, according to Malcolm.

<snip>
FWIW, except for Malcolm's miscapitalizati on of the terms "ANSI C",
I basically agree with his statement. I just don't think it really
needed to be broadcast to the world, any more than it would be
appropriate to start a new thread in alt.usage.engli sh to say,
"Start a new paragraph when there's a new speaker," or in comp.programmin g
to point out that the worst-case running time of Quicksort is O(n^2).
Those who care, already know.


Quite so. But since we're being so public about it at present, my own
preference is xyz_CamelCase for function names and parameter names in the
xyz library (or, perhaps, the library for which xyz is a suitable
contraction or abbreviation), SEPARATED_UPPER _CASE for type names and
macros, and whatever I feel like for local identifiers.

--
Richard Heathfield : bi****@eton.pow ernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton
Nov 14 '05 #9
"E. Robert Tisdale" <E.************ **@jpl.nasa.gov > writes:
[...]
The common style is to use all-caps for constants and macros.


This is an anachronism.


Since when?

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"
(Note new e-mail address)
Nov 14 '05 #10

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

Similar topics

18
4934
by: Robert | last post by:
Hi! I was wondering if the was any way to determine the state of the caps lock key, on or off. Of course I can capture the key events and see whether the caps lock is pressed, but that does not help. I have seen some example that looks at the characters entered in an input field to determine if the caps lock is on, but I was wondering if something is possible that is a bit more immediate to report the caps
7
3898
by: John A Grandy | last post by:
does anyone know of an intrinsic .NET function , or font , or other mechanism , to do "proper-case all-caps" ... ? so, for a name like "Arnold Schwarzenegger" ... .... I want it entirely in capital letters , "ARNOLD SCHWARZENEGGER", *except* that the "A" and the "S" should be a slightly larger font-size than the rest of the letters ...
1
15674
by: charlies224 | last post by:
Hi, I am writting a software that requires me to make sure the Num Lock is always on and Caps Lock is always off. First, I know how to detect if Num Lock or Caps Lock is on or off (if someone is interested, let me know and I will send you the codes). Once we know if the stat of Num Lock/ Caps Lock is not what we desired, we just send the Num Lock / Caps Lock key to change the stat. From most of
114
7888
by: Jonathan Wood | last post by:
I was just wondering what naming convention most of you use for class variables. Underscore, "m_" prefix, camel case, capitalized, etc? Has one style emerged as the most popular? Thanks for any comments. --
2
2869
by: Mick Charles Beaver | last post by:
Hello, I've been looking into using PyLint on some of my programs, just as a best practices kind of thing. Here's a snippet: #====================================================================== if __name__ == '__main__': parser = optparse.OptionParser(usage='usage: %prog ') parser.add_option('-c', '--config',
9
1576
by: trondhuso | last post by:
Hi, I have a solution that - at time of writing - has to use tables to render a list of database-results. My challenge though is that we have used iframes and such to render the different lists on this page, and now - for some reason - the table has become to wide. I am looking at the code and trying to change width using css, but without much luck. I see that in some of the data there are Caps-only text, and I am now wondering if...
18
15663
by: DanicaDear | last post by:
I want to use all caps in a database. I desire to show all caps AS YOU TYPE regardless of how the keyboard/caps lock is set. I tried to format my form field with an on-click event…and this is the code I am trying to use (which I found on the internet while researching this). Private Sub ChangetoUpperCase(KeyAscii As Integer) If KeyAscii >= 97 And KeyAscii <= 122 Then KeyAscii = (KeyAscii - 32) End If End Sub I have tried to put this...
0
9536
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,...
1
10205
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...
0
9063
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, 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...
1
7559
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();...
1
4131
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2933
bsmnconsultancy
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...

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.