473,394 Members | 1,889 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,394 software developers and data experts.

Re: K&R Exercise 6-2

Richard Heathfield wrote:
[...]
In C90, an implementation must be able to distinguish between external
identifiers that are unique in the first 6 characters (without regard to
case!). A program such as the one required in Exercise 6-2 could be useful
for diagnosing source code that ignores this limit (as I suspect a vast
amount of source code does).
So a library which exports e.g. the identifiers string_prepend and
string_append are not really C90 compliant?
August
Aug 29 '08 #1
4 1853
On Fri, 29 Aug 2008 16:51:56 +0200, August Karlstrom wrote:
Richard Heathfield wrote:
[...]
>In C90, an implementation must be able to distinguish between external
identifiers that are unique in the first 6 characters (without regard
to case!). A program such as the one required in Exercise 6-2 could be
useful for diagnosing source code that ignores this limit (as I suspect
a vast amount of source code does).

So a library which exports e.g. the identifiers string_prepend and
string_append are not really C90 compliant?
Correct. However, they are already not C90 compliant -- and not C99
compliant either -- for another reason: external identifiers starting with
str and followed by a lowercase letter are reserved for the implementation.
Aug 29 '08 #2
August Karlstrom said:
Richard Heathfield wrote:
[...]
>In C90, an implementation must be able to distinguish between external
identifiers that are unique in the first 6 characters (without regard to
case!). A program such as the one required in Exercise 6-2 could be
useful for diagnosing source code that ignores this limit (as I suspect
a vast amount of source code does).

So a library which exports e.g. the identifiers string_prepend and
string_append are not really C90 compliant?
Right, for two reasons:

(1) the names invade implementation namespace;
(2) the names are a touch on the long side.

In practice, (1) is often ignored, and (2) is practically always ignored.
But strictly speaking, yes, you are correct.

Of the two reasons, (1) is probably the more important. Whilst it is
certainly possible that some people are still using 6-sig-char linkers
nowadays, it isn't terribly likely that terribly many people are. Even
twenty years ago (and probably more), people were ignoring the 6-character
thing, and it doesn't seem to have caused any major software crises.

--
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
Aug 29 '08 #3
Harald van Dijk wrote:
On Fri, 29 Aug 2008 16:51:56 +0200, August Karlstrom wrote:
>Richard Heathfield wrote:
[...]
>>In C90, an implementation must be able to distinguish between external
identifiers that are unique in the first 6 characters (without regard
to case!). A program such as the one required in Exercise 6-2 could be
useful for diagnosing source code that ignores this limit (as I suspect
a vast amount of source code does).
So a library which exports e.g. the identifiers string_prepend and
string_append are not really C90 compliant?

Correct. However, they are already not C90 compliant -- and not C99
compliant either -- for another reason: external identifiers starting with
str and followed by a lowercase letter are reserved for the implementation.
Annoying. Is there a way to make a compiler like GCC emit a warning in
this case?
August
Aug 30 '08 #4
Richard Heathfield wrote:
August Karlstrom said:
>So a library which exports e.g. the identifiers string_prepend and
string_append are not really C90 compliant?

Right, for two reasons:

(1) the names invade implementation namespace;
(2) the names are a touch on the long side.

In practice, (1) is often ignored, and (2) is practically always ignored.
But strictly speaking, yes, you are correct.

Of the two reasons, (1) is probably the more important. Whilst it is
certainly possible that some people are still using 6-sig-char linkers
nowadays, it isn't terribly likely that terribly many people are. Even
twenty years ago (and probably more), people were ignoring the 6-character
thing, and it doesn't seem to have caused any major software crises.
Thanks for the clarification.
August
Aug 30 '08 #5

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

Similar topics

6
by: leonard greeff | last post by:
I want to know the correct way to answer exercise 1-11 of K&R. The only bug that I can find is that nw counts one to many words. (if there are 8 words, nw will be 9) Am I correct aor is there more...
46
by: Herrcho | last post by:
Hi~ i've studied C for a few months myself, and i'd appreciate it if anyone could improve my coding or correct it. the following is my solution to the K&R exercise 2-3 "Write the function...
12
by: Chris Readle | last post by:
Ok, I've just recently finished a beginning C class and now I'm working through K&R2 (alongside the C99 standard) to *really* learn C. So anyway, I'm working on an exercise in chapter one which...
12
by: Merrill & Michele | last post by:
It's very difficult to do an exercise with elementary tools. It took me about fifteen minutes to get exercise 1-7: #include <stdio.h> int main(int orange, char **apple) { int c; c=-5;...
8
by: Mike S | last post by:
Hi all, I noticed a very slight logic error in the solution to K&R Exercise 1-22 on the the CLC-Wiki, located at http://www.clc-wiki.net/wiki/KR2_Exercise_1-22 The exercise reads as...
16
by: Josh Zenker | last post by:
This is my attempt at exercise 1-10 in K&R2. The code looks sloppy to me. Is there a more elegant way to do this? #include <stdio.h> /* copies input to output, printing */ /* series of...
19
by: arnuld | last post by:
this programme runs without any error but it does not do what i want it to do: ------------- PROGRAMME -------------- /* K&R2, section 1.6 Arrays; Exercise 1-13. STATEMENT: Write a program...
5
by: arnuld | last post by:
this is a programme that counts the "lengths" of each word and then prints that many of stars(*) on the output . it is a modified form of K&R2 exercise 1-13. the programme runs without any...
9
by: JFS | last post by:
I know most of you have probably read "The C Programming Language" (K&R) at some point. Well here is something that is driving me crazy. The exercises are impossible (most of them) for me to do....
88
by: santosh | last post by:
Hello all, In K&R2 one exercise asks the reader to compute and print the limits for the basic integer types. This is trivial for unsigned types. But is it possible for signed types without...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
Oralloy
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,...
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...

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.