|
Microsoft was offering "no code database development" in Visual Basic 3, and that was released in 1993.
It's true, using VB3 you could build a database system by doing nothing more than dragging and dropping controls onto a form and clicking the property showing where you'd like to source the data from.
Yet here we are, 27 years later, and I'm continuing to have a good career as a software developer specializing in databases.
No code systems will continue to exist, they will continue be used by "Power users" who all have varying degree of skill, and they will continue to be the bane of the real IT professional who is asked to come up and fix the mistakes of the "Power user", usually after data is lost or a business critical limitation is reached.
|
|
|
|
|
Does it bother anyone else that you declare a pointer like:
char* sz;
But an array is declared like this:
char sz[1024];
I think it's inconsistent, and I think the array specifier should have been declared with the type since it's essentially a type modifier like * and &
Maybe it's just me?
Real programmers use butterflies
|
|
|
|
|
In both instances the first part declares the type, the second declares the variable. The array modifier is telling you how many of the type.
Think of the first declaration as having a silent '[1]' and it becomes consistent.
And you might be 40 years too late for bringing up this argument!
If you can't laugh at yourself - ask me and I will do it for you.
|
|
|
|
|
I guess that makes sense.
DRHuff wrote: And you might be 40 years too late for bringing up this argument!
At least!
Real programmers use butterflies
|
|
|
|
|
What has bothered me more is the fact that:
int* pa;
int *pa;
are the same. Had I been Bjorn, I wouldn't have allowed the latter.
|
|
|
|
|
I can see why but on the other hand I don't like the idea of significant whitespace between tokens in language. It's one of the reasons I don't like Python.
Real programmers use butterflies
|
|
|
|
|
But you can also write:
int*pa;
int * pa;
the spaces do not affect the binding. And that was the rule way before the great Stroustrup.
|
|
|
|
|
Agree, the later makes no sense.
I'm not sure how many cookies it makes to be happy, but so far it's not 27.
JaxCoder.com
|
|
|
|
|
The latter may be the better notation since I can declare;
int *pa, a;
where pa is a pointer to an int and a is an int. If I declare
int* pa, a;
this is also legal, where pa is still a point to an int and a is an int.
|
|
|
|
|
I was just to reply with the same.
I always put the * modifier RIGHT in front of the variable. And it makes sense since, "char *" is not really the type. A lot of beginners are confused when something like the following:
char* psz, pszHi, pszBye;
and they discover pszHi / pszBye are just character variables.
Code like the following helps those initiates:
char *psz, *pszHi, *pszBye, chA, chB, *pszString3;
Just my $0.02.
|
|
|
|
|
They are literally half backward. In order to understand a C type definition, you ping-pong between the part before the name and the part after, until all tokens have been processed.
If there is one single thing for K&R ought to have been taken out and shot, this is it!
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Let it Rust!
|
|
|
|
|
The usage is odd as well:
char* p = ...
*p = 'x'; Vs
foo f;
foo *pf = &f;
f.x = '?';
pf->x = '!'; Why invent two access operators "." and "->", when you could just use "*pf.x" and be more consistent? Or use "->" to dereference all pointers?
I get the feeling bits of the C spec were thrown in just before the submission deadline ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Quote: Why do we do this? I'll tell you... I don't know. But because of this, every one of us knows what a pointer is, how to dereference it, and what K&R expect of him.
With apologies to Sholem Aleichem and to the producers of Fiddler on the Roof
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
Beautiful. I'm proud of you.
Ravings en masse^ |
---|
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
|
If you read it in reverse it can make more sense:
char * sz;
char sz[1024];
|
|
|
|
|
The floating asterisk looks lonely!
Real programmers use butterflies
|
|
|
|
|
There's a stricter formal rule, called the Right-Left rule.
I wrote my only technical article on CP more than 15 years back on just this: How to interpret complex C/C++ declarations
Cheers,
विक्रम
"We have already been through this, I am not going to repeat myself." - fat_boy, in a global warming thread
|
|
|
|
|
Yes, but I could not remember it. I know it's important when typedef 'ing function pointers.
I just reread your article - very interesting, and should be required reading for all the QA kiddies.
|
|
|
|
|
char* means you should read the footnote.
* array declarations in C may or may not be consistent.
|
|
|
|
|
|
|
Stop whining.
Declarations made easy.
Computer Language Magazine, May, 1991.
If you can keep your head while those about you are losing theirs, perhaps you don't understand the situation.
|
|
|
|
|
Without wishing to start a major language debate, I think its important to understand that C was designed to be efficient at using the underlying hardware of the machine, and the way things are declared reflects this:
char *sz declares a single variable that points to a place in memory, supposedly holding a char value. This pointer (and here's where dragons lie!) can be made to point to anywhere and to anything regardless of its declaration, you are just telling the compiler that at the place where that pointer points, YOU consider there to be a char value (whether it is or not in reality).
char sz[1024] says that at the address represented by sz is a reserved block of memory that holds (in theory) 1024 char items.
In your code you can (with some severe caveats!) use both variables in the same way and it's up to you to remember and manage whatever you think you are looking at in that location - this is both the beauty and danger of a language like C - it allows you to manipulate things in much the same way as in assembler and with as few restrictions, but it provides no protection against you doing something stupid.
However, even the early compilers would detect if you attempted to treat these two variables as exactly equivalent, but would often only warn rather than prevent it, allowing you to create absolute havoc.
Much code rot is caused by the developer incorrectly assuming that, by default, either of these variables is initialised (which is why most compilers these days will attempt to put something sensible in newly declared variables to protect the innocent). Before initialisation char *sz may contain a random address and even attempting to look at it might cause a total system crash if it accidentally points into hardware protected memory. With char sz[1024] though you can be sure that doing char x = *sz is safe because sz already holds a valid address and points into memory allocated to your program, what you don't know is what value you will actually get back from that place before the array is initialised.
Why have I bored you all with this stuff? Because so many developers these days seem to know absolutely nothing at all about how the hardware they are driving works - that's fine if you are writing in a high-level domain specific language where everything like that is hidden - no help at all if you are writing a device driver for some complex piece of hardware that is integrated into an operating system of some sort.
|
|
|
|