473,403 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,403 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 1855
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
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,...
0
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...

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.