C provides the infinitely-abusable goto statement, and labels to branch to. Formally, the goto is never necessary, and in practice it is almost always easy to write code without it. We have not used goto in this book. -- K&R (2nd Ed.) : Page 65
PB is very weak with constants and array initialization. Although I much prefer it to C, I have been contemplating doing some libraries in C just to avoid the kludgey workarounds.
Tenaja wrote:Well for one, to pass the pointer to a procedure.
That doesn't answer my question. Why do you need a pointer to a constant.
C provides the infinitely-abusable goto statement, and labels to branch to. Formally, the goto is never necessary, and in practice it is almost always easy to write code without it. We have not used goto in this book. -- K&R (2nd Ed.) : Page 65
You don't NEED one--there is always a work-around. But, then again, with IF, you don't NEED While or For, either. I'm sure the majority of PB's features could be removed if we only included those that were NEEDED.
If you have a proc that handles strings, why limit it to variable strings????
Are Constants SUPPOSED to be second-rate data structures that have limited options?
I'm sorry, i do not agree at all with this request. Constants are constants and should never be changed, therefore you don't need a pointer to them, you can pass them by value to a function. If you needed a pointer to a constant because you want to change it, then that is a variable so use one. Would you ever need a pointer to a constant that never changes? If so whats wrong with using it by value?
While and for loops serve a good purpose so of course they are required because they cut down on repetitious code.
Just adding features without thinking it through is not a good design philosophy.
C provides the infinitely-abusable goto statement, and labels to branch to. Formally, the goto is never necessary, and in practice it is almost always easy to write code without it. We have not used goto in this book. -- K&R (2nd Ed.) : Page 65
A Constant is nothing more then a datasection inside of your code.
You can need a pointer to data and only read that ... no need to change.
So constants will be still constants. And it is already possible to use
the pointer from Datasections and literal-constants. It is only not allowed
to use the pointer-symbol at a constant itself. I don't know if i would
use that, if it is possible ... but it is not bad to be possible to get the
pointer.
Why would you need a pointer to a constant though?
C provides the infinitely-abusable goto statement, and labels to branch to. Formally, the goto is never necessary, and in practice it is almost always easy to write code without it. We have not used goto in this book. -- K&R (2nd Ed.) : Page 65
All i want is that a explanation is given where you actually need a pointer to a constant. I'm willing to learn i just don't get why you would need a pointer to something which will never change rather than just deal with the value.
C provides the infinitely-abusable goto statement, and labels to branch to. Formally, the goto is never necessary, and in practice it is almost always easy to write code without it. We have not used goto in this book. -- K&R (2nd Ed.) : Page 65
It's probably not the best example (since you could define the function differently and use a string parameter directly)
but it shows why something like this can be useful.