malloc() implementation

R

Richard Heathfield

Haider said:
Please go to the following link you will get a copy of K&R in pdf
format

That's incitement to copyright violation.

I've sent a complaint to (e-mail address removed) - hopefully they can
explain to Haider about "intellectual property". Perhaps others here would
care to do the same.

I have also sent a note to the relevant person at Prentice-Hall, advising
him of the existence of this illicit electronic copy of K&R.

Not wanting to send him duff gen, I checked the file first. It is indeed a
copy of K&R, but it is a very poor-quality copy. Learners of C would be
much better served by buying a paper copy of K&R. This is better because:

(a) you can read it with a clear conscience;
(b) you can read it independently of any electronic device - no batteries
required;
(c) you can be sure that you have the correct text;
(d) you can look things up much more quickly.

Actually, (d) surprised me. But it's true. Having a copy of K&R right there
on the desk in front of me, I find myself reaching for it when I need to
check, say, which way round args 2 and 3 to fread/fwrite go, because it's
actually less hassle than firing up a terminal, loading the Standard into a
searchable viewer of some kind, and typing in my search criteria.

If you haven't got a paper copy of K&R2, pick up the phone, get on to your
bookshop, and order one *today*.
 
C

Clever Monkey

Eric said:
"Hallmark of C ..." Fuzzy concept, that. Yet the Rationale
invokes the "Spirit of C," so perhaps we can dither a bit without
risk of too much castigation.
I certainly hope so! I meant it simply as "a distinguishing
characteristic or characteristics".
In my own (less than universal) experience, two obstacles to
interposing your own malloc() -- or sqrt(), or whatever -- are
fairly frequently found:

- The Standard library may be incorporated into the program
as an indivisible unit: You get the whole thing, or nothing
at all. This is/was the case on VMS in the Old Days, when
the whole schmear was implemented as one giant monolithic
shared library. VMS' linker would squawk about conflicting
symbol definitions if your home-grown malloc() had the same
name as the malloc() in the library.
Right, I recall that older C libs from Borland also had the same issue.
Point taken.
- The library itself may use unadvertised knowledge of its own
internals. (It pretty much must do so if things like atexit()
and fflush(NULL) are to work.) For example, imagine an fopen()
that for performance reasons wants to allocate an I/O buffer
on a memory page boundary. It might call a library-private
_malloc_pages() function to get such specially-aligned memory.
Fine so far: You haven't replaced _malloc_pages(), so the
library's own version is used. But what if fopen() then hands
the buffer memory to free()? It's (presumably) your free(),
not the library's free(), that gets called -- and what are
the chances that your free() and the library's free() use
identical data structures?
Ah, so if that internal symbol was linked in some other manner, it would
not see your symbol. This is, in fact, what van der Linden mentions in
his discussion of interpositioning. On his reference platform at least
(Solaris) he indicates that danger in that everything linked in later
after your redefined symbol will see it.

If I understand you correctly, this is not any sort of guarantee, and
your redefined symbol will not occlude the standard symbol in a properly
defined manner.
It's a shame, really, that C doesn't have a mechanism to allow
overriding parts of the library. Because abuses of dynamic memory
are so common, the malloc() suite is perhaps the most mouth-watering
override target, but there are others: A gets() that bleats whenever
called, or a scanf() that complains if given a "%s", even an acos()
that dumps a stack trace if its argument is larger than 1. The C
Standard, though, makes a point of separating the roles of implementor
and user -- and having lived on both sides of that fence, I for one
find the fence something of a comfort.
Indeed. I know that when we invented our C library back in the day when
such a thing was rare and expensive on the platforms we needed to
target, we invented a naming scheme of m_whatever(). It becomes clearer
to me why we did that.

Do be somewhat more on topic, I note that for a C project I worked on
recently that did a lot of memory allocation/deallocation we ended up
making a custom_malloc() that could be redefined to a debug_malloc() at
compile time. That caught a lot of potential crashes in the early
phases of the development. Once we shook the bugs out, custom_malloc()
was pointed back at malloc().
 
H

Haider

Richard said:
Haider said:


That's incitement to copyright violation.

I've sent a complaint to (e-mail address removed) - hopefully they can
explain to Haider about "intellectual property". Perhaps others here would
care to do the same.
it is for those peoples who don't have a copy and still don't want to
get one as far as (e-mail address removed) is concern I got the link by
as the serch result of google itself.
 
F

Flash Gordon

Haider said:
it is for those peoples who don't have a copy and still don't want to
get one

You mean thieves? I'm not too fond of them myself. After all K&R put a
lot of work in to that book (including the development of the language
it describes) so they are entitled to receive payment for it.
> as far as (e-mail address removed) is concern I got the link by
as the serch result of google itself.

Irrelevant. You can find all sorts of illegal stuff using Google, that
does not make posting links to it acceptable.

But do read the book.

Only *after* buying a copy.
 
S

santosh

Haider said:
it is for those peoples who don't have a copy and still don't want to
get one...

The book is available only via purchase. Free downloads on the Internet
are illegal and a copyright violation. A newbie, who may not know
better, might read your post and go ahead and download it, thus morally
and legally compromising himself.
as far as (e-mail address removed) is concern I got the link by
as the serch result of google itself.

Try giving this defense in court.

Google only provides a search service for material on the Internet.
Their legality is something that the user has to be aware of.

.... snip ...
But do read the book.

Hahahahahaha!

Your prompting Richard Heathfield to read K&R...!?!
:)
 
H

Haider

santosh said:
The book is available only via purchase. Free downloads on the Internet
are illegal and a copyright violation. A newbie, who may not know
better, might read your post and go ahead and download it, thus morally
and legally compromising himself.
but now newbie will purchase a book also till now Richard Heathfield
inform Prentice Hall
and they took steps to remove the link.
so don't worry.
 
H

Haider

Flash said:
You mean thieves? I'm not too fond of them myself. After all K&R put a
lot of work in to that book (including the development of the language
it describes) so they are entitled to receive payment for it.
they deserves and they will bcoz this book is such a good one that
anyone who have a look of it will purchase a copy.
 
J

Jordan Abel

Try giving this defense in court.

Google only provides a search service for material on the Internet.
Their legality is something that the user has to be aware of.

So it's legal for Google to link to it but not for a private citizen to
do so? (Not that I agree with copyright violation, but how's he supposed
to know that a search result he found isn't legitimate?)
 
S

Suman

Jordan said:
So it's legal for Google to link to it but not for a private citizen to
do so? (Not that I agree with copyright violation, but how's he supposed
to know that a search result he found isn't legitimate?)

[1] It is difficult (if not impossible) to build such discretion in a
system.
It is however perfectly acceptable to ask for such a quality among
human beings.

[2] Google is not soliciting that you try that out. The poster in
question did.
That's illegal, if I'm not mistaken, from a legal perspective.
 
S

santosh

Jordan said:
So it's legal for Google to link to it but not for a private citizen to
do so? (Not that I agree with copyright violation, but how's he supposed
to know that a search result he found isn't legitimate?)

Google uses automated methods to build their indexes. Their staff
cannot review each and every webpage their web crawlers traverse.

Usually, when authors want to protect their IP, they provide some sort
of copyright notice or license etc. If this is available, people are
expected to read and follow it. Now granted tons of legal and illegal
stuff on the Internet is accompanied by no terms of use. A newbie might
not even know that the said material is illegal. That's why Richard
Heathfield posted a follow-up to Haider's unwanted link.

Ultimately, people have one or two little things called intelligence,
common sense and conscience, which they are expected to exercise.
Companies and web-bots have none of the above. Err...atleast not the
third faculty.
 
S

santosh

Haider said:
they deserves and they will bcoz this book is such a good one that
anyone who have a look of it will purchase a copy.

That's not garunteed and is beside the point, i.e., that your link is
still an encouragement of copyright violation.
 
R

Richard Heathfield

santosh said:
Hahahahahaha!

Your prompting Richard Heathfield to read K&R...!?!
:)

Well, yes, it's true that I don't need prompting.

K&R2 is always to hand here, and consulted regularly.
 
K

Keith Thompson

Jordan Abel said:
So it's legal for Google to link to it but not for a private citizen to
do so? (Not that I agree with copyright violation, but how's he supposed
to know that a search result he found isn't legitimate?)

I have no idea whether posting a link to an illegal copy of a
copyrighted work is illegal in whatever jurisdiction the poster
happens to live in. I suggest that speculating about whether posting
a link is legal or not is a waste of time. Anyone who feels the need
to discuss it can go to misc.int-property.

The point, I think, is that posting a link to an illegal copy of K&R
is *rude*. Kernighan and Ritchie deserve to be paid for their
considerable efforts. Don't encourage theft of their intellectual
property.
 
J

Jordan Abel

I have no idea whether posting a link to an illegal copy of a
copyrighted work is illegal in whatever jurisdiction the poster
happens to live in. I suggest that speculating about whether posting
a link is legal or not is a waste of time. Anyone who feels the need
to discuss it can go to misc.int-property.

The point, I think, is that posting a link to an illegal copy of K&R
is *rude*. Kernighan and Ritchie deserve to be paid for their
considerable efforts. Don't encourage theft of their intellectual
property.

The other problem is that he _himself_ might not have known it wasn't
legal - there's lots of material online under open licenses (GPL, GFDL,
CC) or otherwise free to copy (like WG14's stuff). While it certainly
deserves pointing out (and the site that has it up should be reported to
the publisher - and if it weren't in russia, the hosting ISP), the
response seemed a bit rude also.
 
A

Al Balmer

The other problem is that he _himself_ might not have known it wasn't
legal - there's lots of material online under open licenses (GPL, GFDL,
CC) or otherwise free to copy (like WG14's stuff).

Such material is always, in my experience, clearly designated as such.
OTOH, the appearance of a book image, complete with cover, but missing
the copyright page, is a pretty good clue that something's not kosher.

Since most publications are copyrighted by default, one must assume
they are not available without permission, in the absence of a notice
to the contrary.
 
B

Ben Pfaff

Keith Thompson said:
The point, I think, is that posting a link to an illegal copy of K&R
is *rude*. Kernighan and Ritchie deserve to be paid for their
considerable efforts.

Interesting point. The copyright date in K&R2 is 1988. Given
the original 14-year span of copyright in the United States, the
copyright on K&R2 would have expired in 2002. One would think
that K&R made some money on it in those years.

Of course, these days, copyrights never expire in an author's
lifetime.
Don't encourage theft of their intellectual property.

Funny how the definition of "theft" expands as time goes on.
 
J

Jordan Abel

Interesting point. The copyright date in K&R2 is 1988. Given
the original 14-year span of copyright in the United States,

The original span was 28 years. Two 14-year periods. That would put its
expiration at 2016, if they bothered to renew it in 2002.
 
W

W H G

Jordan Abel said:
The original span was 28 years. Two 14-year periods. That would put its
expiration at 2016, if they bothered to renew it in 2002.


------------> According to a handy Almanac, works created after
Jan 1, 1978 (obviously K&R!) are protected for seventy years
after the last joint author dies.
As I remember, until the 70's the copyright was for 28 yrs, renewable
once - but I do remember seeing something that many yrs ago it was
14 years.
W H G
--------------------------------------------------------
 
J

Jordan Abel

------------> According to a handy Almanac, works created after
Jan 1, 1978 (obviously K&R!) are protected for seventy years
after the last joint author dies.
As I remember, until the 70's the copyright was for 28 yrs, renewable
once - but I do remember seeing something that many yrs ago it was
14 years.

Yes, but at that time it was also renewable [for a total of 28].
 
P

pete

Michael said:
Consider it a quirk of word-by-word translation; the OP
probably meant "Hello everybody"/"Hi all".

<snip>

The lack of a plural "you",
is a defficiency of the modern English language.

http://dictionary.reference.com/search?q=y'all&db=*

The single most famous feature of Southern United States dialects
is the pronoun y'all, sometimes heard in its variant you-all.

In addition to y'all, other forms for plural you include you-uns,
youse, and you guys or youse guys.
Youse is common in vernacular varieties in the Northeast,
particularly in large cities such as New York and Boston,
and is also common in Irish English.
You-uns is found in western Pennsylvania and in the
Appalachians and probably reflects the Scotch-Irish roots of many
European settlers to these regions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,183
Messages
2,570,969
Members
47,524
Latest member
ecomwebdesign

Latest Threads

Top