Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Why Case Sensitive?

Reply
Thread Tools

Why Case Sensitive?

 
 
Bart
Guest
Posts: n/a
 
      07-19-2007
Why is C case sensitive?

I know it's a bit late to change it now but there would seem to be far
more advantages in ignoring letter case in source code.

In real life such a situation would be ridiculous (eg. the 16 ways of
writing my name) and, in some cases, frightening.

Is it to avoid having to think up new identifiers? And how would you
distinguish case when reading out bits of code over the phone for
example?

Bart

 
Reply With Quote
 
 
 
 
santosh
Guest
Posts: n/a
 
      07-19-2007
On Thursday 19 Jul 2007 3:19 pm, Bart <(E-Mail Removed)> wrote in
message <(E-Mail Removed) .com>:

> Why is C case sensitive?
>
> I know it's a bit late to change it now but there would seem to be
> far more advantages in ignoring letter case in source code.
>
> In real life such a situation would be ridiculous (eg. the 16 ways
> of writing my name) and, in some cases, frightening.
>
> Is it to avoid having to think up new identifiers? And how would
> you distinguish case when reading out bits of code over the phone
> for example?


C is case sensitive because computing systems are naturally case
sensitive. It takes extra effort to *not* be case sensitive. Input
devices like keyboards need to distinguish between cases, as do
output devices, text utilities, typesetting systems etc.

Real world is case sensitive and so are computers.

 
Reply With Quote
 
 
 
 
Chris Dollin
Guest
Posts: n/a
 
      07-19-2007
Bart wrote:

> Why is C case sensitive?


Because there's no good reason to make it case-insensitive, case
sensitivity comes for free, and case sensitivity allows some
useful conventions such as UPPERCASE macros and having a convenient
distinction between Types and objects.

> And how would you distinguish case when reading out bits of code
> over the phone for example?


Whatever worked. The nice thing about having real people at the
other end of the phone is that you can sort out a protocol in
the cases where it matters. ("I'll email you the source" is one
such.)

I don't know about you, but I pronounce INT and int differently
when I think it might matter.

--
Kris "with an English accent" DOLL-inn

Hewlett-Packard Limited registered no:
registered office: Cain Road, Bracknell, Berks RG12 1HN 690597 England

 
Reply With Quote
 
Malcolm McLean
Guest
Posts: n/a
 
      07-19-2007

"Bart" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Why is C case sensitive?
>
> I know it's a bit late to change it now but there would seem to be far
> more advantages in ignoring letter case in source code.
>
> In real life such a situation would be ridiculous (eg. the 16 ways of
> writing my name) and, in some cases, frightening.
>
> Is it to avoid having to think up new identifiers? And how would you
> distinguish case when reading out bits of code over the phone for
> example?
>

It can be a problem, because humans remember words, not punctuation.

I use the convention that if a function depends on the standard library and
nothing else then it is all lowercase, whilst if it calls platform-specific
functions it starts with an uppercase letter.

Fortran 77 is case insensitive, and this contributes to Fortran 77 code
being quite hard to read.

 
Reply With Quote
 
santosh
Guest
Posts: n/a
 
      07-19-2007
On Friday 20 Jul 2007 1:38 am, Malcolm McLean
<(E-Mail Removed)> wrote in message
<(E-Mail Removed)>:
>
> "Bart" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) oups.com...
>> Why is C case sensitive?
>>
>> I know it's a bit late to change it now but there would seem to be
>> far more advantages in ignoring letter case in source code.


[ ... ]

> It can be a problem, because humans remember words, not
> punctuation.


The do remember case. Case is used to indicate context specific
information in the written language. Computers that don't support
case sensitivity are like the "l33t" and "sms" type posters - ugly
and confusing to understand.

> I use the convention that if a function depends on the standard
> library and nothing else then it is all lowercase, whilst if it
> calls platform-specific functions it starts with an uppercase
> letter.


What about functions that don't call any external code, or code
that's neither platform specific nor part of the Standard C library?


 
Reply With Quote
 
August Karlstrom
Guest
Posts: n/a
 
      07-19-2007
Malcolm McLean skrev:
> I use the convention that if a function depends on the standard library
> and nothing else then it is all lowercase, whilst if it calls
> platform-specific functions it starts with an uppercase letter.


If the implementation changes you may end up with naming inconsistency.


August
 
Reply With Quote
 
Malcolm McLean
Guest
Posts: n/a
 
      07-19-2007

"August Karlstrom" <(E-Mail Removed)> wrote in message
news:_wQni.4443$(E-Mail Removed)...
> Malcolm McLean skrev:
>> I use the convention that if a function depends on the standard library
>> and nothing else then it is all lowercase, whilst if it calls
>> platform-specific functions it starts with an uppercase letter.

>
> If the implementation changes you may end up with naming inconsistency.
>

If a function does no IO then there is no reason for it to call any
platform-specific functions, except very rarely when for efficiency reasons
a calcualtion cannot be coded in C. So separate your functions from your
procedures, and the situation cannot arise.

Unfortunately reality sometimes kicks in. For instance a lot of long
procedures work fine in development, but for commercial use they need to
support progress bars and user cancels. Error conditions can also be a
problem, as can dependencies on big datasets. Generally however the system
works.
Then of course the standard does provide methods for basic IO, which can
break.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm


 
Reply With Quote
 
August Karlstrom
Guest
Posts: n/a
 
      07-19-2007
Bart skrev:
> Why is C case sensitive?
>
> I know it's a bit late to change it now but there would seem to be far
> more advantages in ignoring letter case in source code.
>
> In real life such a situation would be ridiculous (eg. the 16 ways of
> writing my name) and, in some cases, frightening.


Exactly, but on the other hand, with case insensitivity the compiler
will accept 16 different ways to refer to the object designated by BART
which imho. is even more confusing.

> Is it to avoid having to think up new identifiers? And how would you
> distinguish case when reading out bits of code over the phone for
> example?


E.g. by spelling out each character prefixed by upper/lower or by saying
"in lower case", "in UPPER CASE", "in camelCase", "in PascalCase" etc.
before the name of the identifier.

A third alternative is to allow only one "spelling" of an identifier,
that is if an identifier is declared as Bart

1. it must be referred to as Bart and

2. the identifiers BART, bart, bArt etc. can not exist in the same scope.


August
 
Reply With Quote
 
Mark McIntyre
Guest
Posts: n/a
 
      07-19-2007
On Thu, 19 Jul 2007 15:37:17 +0530, in comp.lang.c , santosh
<(E-Mail Removed)> wrote:

>On Thursday 19 Jul 2007 3:19 pm, Bart <(E-Mail Removed)> wrote in
>message <(E-Mail Removed) .com>:
>
>> Why is C case sensitive?
>>

>C is case sensitive because computing systems are naturally case
>sensitive.


This is true NOW, but was not generally true prior to 1970 or so. The
first computers I worked with didn't have much in the way of lowercase
letters. There's a reason why Basic wasn't case-sensitive, and I
recall that F66 required all upper case.

>Real world is case sensitive


Not entirely true either... The Romans and Greeks lived in
case-insensitive worlds.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
Reply With Quote
 
Bart
Guest
Posts: n/a
 
      07-20-2007
On Jul 19, 11:07 am, santosh <(E-Mail Removed)> wrote:
> On Thursday 19 Jul 2007 3:19 pm, Bart <(E-Mail Removed)> wrote in
> message <(E-Mail Removed) .com>:
>
> > Why is C case sensitive?


> C is case sensitive because computing systems are naturally case
> sensitive. It takes extra effort to *not* be case sensitive. Input
> devices like keyboards need to distinguish between cases, as do
> output devices, text utilities, typesetting systems etc.
>
> Real world is case sensitive and so are computers.


No, in the real world Tom, tom and TOM are not considered to be
different names. And when sorting you don't really want Aardvark to
come after zebra.

Yes, some extra effort is needed to ignore case when determining
whether one name (or title, filename, etc) is identical to another.

I think a case insensitive C would have still worked well, and you
could still use upper case for macros and obey the usual conventions,
except you couldn't use the identical name, in the same scope, for a
Type and a Variable** for example; you'd need to think up something
new. [** I have a feeling someone will say these two use different
namespaces so identical names would be possible]

Bart

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
"Case 1 To 5" in Select case, giving Error!!. Why? Lakshmi Narayanan.R ASP General 10 03-04-2005 01:13 AM
how to case select with case-insensitive string ? Tee ASP .Net 3 06-23-2004 07:40 PM
Possible to turn on/off cookieless sessions dynamically on a case by case basis at run-time? Steve Franks ASP .Net 2 06-10-2004 02:04 PM



Advertisments