|
You could use 123[name] as an alternative - that matches the original PDP addressing mode syntax better as well, I suspect!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
honey the codewitch wrote: 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 &
One thing it's not is inconsistent - the pointer modifier belongs with the variable, not the type. For example, the following fragment declares a pointer to integer variable and an integer variable.
int *pa, a;
See this Godbolt...
One option, were you using C++...
template<class T, size_t N>
using Array = T[N];
template<class T>
using Ptr = T*;
Array<int, 10> test_array;
Ptr<int> test_pointer;
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Stuart Dootson wrote: One thing it's not is inconsistent - the pointer modifier belongs with the variable, not the type.
Yet it's a type modifier. A pointer to an int is a different type than an int.
Real programmers use butterflies
|
|
|
|
|
Quote: Does it bother anyone else that you declare a pointer like:
char* sz;
It only looks odd if you use it like that. If you use it like the way it was meant to be used:
char *sz;
It makes sense. The way you write it is not consistent and lends itself to errors.
char* szA, szB, szC;
char *szD, *szE, *szF;
Putting the "*" next to the typename is logically inconsistent - you still have to put the "*" in the correct place for other pointer types:
void (*fptr) (void);
So instead of doing it one way for some variables and the correct way for others, just do it the correct way for all.
|
|
|
|
|
I suppose then that I do not like that type modifiers are not declared with the type.
Real programmers use butterflies
|
|
|
|
|
Quote: I suppose then that I do not like that type modifiers are not declared with the type.
Pointers aren't type modifiers.
You can tell by the way that actual type modifiers can be placed in any order ("short int" and "int short") while the pointer notation can only go before the variable name.
short int si1;
int short si2;
short int *psi3;
*short int psi4;
If you do not associate the '*' with the variable name, then everything looks very confusing and arbitrary and some things that should work won't. If you associate the '*' with the variable name then everything is logical and can be worked out - any "*symbol" means that symbol is a pointer to something, so things like this can be worked out:
const char *varname[100];
You cannot logically infer what that means if you think that the "*" is part of the typename. If the "*" is part of the type, that would mean that the pointer can not be changed. In reality, it is the individual chars that cannot be changed, while each of the pointers in the array can be changed.
There's a lot of misunderstanding that will happen when "typename* varname" is used in place of "typename *varname". A compiler won't catch all of it.
|
|
|
|
|
It bothers me to no end. Actually what bothers me even more is that every time I mention it, I mostly get replies defending the stupid Spiral of Death. It's bad enough that it's bad, but worse that people feel this kind of Stockholm Syndrome towards a type syntax that just doesn't make sense. (in some sense it's not even a type syntax, because it's not just a type, there's a declaration stuck in the middle of it)
Anyway I'll show you something even worse, the syntax for returning a function pointer. Let's say you want to return a pointer to a function that takes two ints and returns an int, a function like int add(int a, int b) maybe. It would look like this:
int (*getFunc())(int, int) { … }
Unless you use a typedef of course (in C# that is essentially mandatory: you must declare a delegate with the signature first and then you can use that).
|
|
|
|
|
harold aptroot wrote: but worse that people feel this kind of Stockholm Syndrome towards a type syntax that just doesn't make sense
I think you're the first person on this thread to agree with me.
Real programmers use butterflies
|
|
|
|
|
Greetings but I must differ
int foobar(int, int) { return 0; }
// I merely followed the operator rules of precedence and associativity for:
// "f is a pointer to a function which takes two arguments of type int and int and returns an int"
// and voila though the return type doesn't seem to be an operator unless perhaps a cast operator
int (*f)(int, int) = foobar; // compiles ok
int (*getFunc())(int, int) = foobar; // compiles with syntax error
// Cheerios
|
|
|
|
|
But that's not what I wrote. I wanted to return a function pointer from a function named getFunc .
|
|
|
|
|
Greetings and Kind Regards Please permit me to demonstrate the following: By merely following the rules of operator precedence and associativity I deduce the same declaration for getFunc as yourself. I thank Harbison & Steele for teaching me this in their fine C text. Why K&R don't do this is difficult to understand.
// "getFunc is a function which returns a pointer to a function which takes two int args and returns an int"
// getFunc is a function ...
getFunc()
// ... which returns a pointer ...
*getFunc()
// ... to a function which takes two int args ...
*getFunc()(int, int)
(*getFunc())(int, int) // added ()'s because function call (int, int) has higher precedence than indirection *
// ... and returns an int
int (*getFunc())(int, int)
// Voila No Spiral of Death is needed. Best Wishes Cheerios
|
|
|
|
|
It's hard to believe that of all the replies no one has ever read K&R C.
A variable declaration consists of a type and name and possibly a type reference spec such as * or [].
Multiple variable declarations may be combined in a single statement (line) if they are the same type. this is why reference specs go with the name
char *sz, sz2[], sz3[1024];
Types and reference specs can also have modifiers which are can get very confusing with multiple declarations combined on a line.
static const char sz4, *sz5, const *sz6;
Add initializers and you will see why it's pretty standard now days to put one declaration per line.
|
|
|
|
|
Greetings and Kind Regards May I please direct you to my previous post. Cheerios
The Lounge[^]
|
|
|
|
|
C declarations are fine. The problem is in C pointer expressions, where two unfortunate changes were made. First, Ritchie (I presume) chose to make * the pointer dereference operator and either chose or had forced upon him by the * choice the need to make it a *left* unary operator. Had he followed Wirth's prior example in Pascal (using p^ to dereference p), then your backwards issue is automatically solved.
Why? Because C declarators are based on how the variable is used in an expression. So int *p; has the * first because you use *p in an expression to make use of the pointer. The array dimension come after the variable name: int a[5]; because you use a[index] in an expression to access a member of an array.
If the pointer dereference was on the right, then you wouldn't need the quirky -> operator that only exists to cut down on parentheses, where p->member exists only to avoid typing (*p).member.
By the way, the declaration should be "char *p;" instead of the awful "char* p;" that revisionists like to type. The * says that p is a pointer, not that "char" is a pointer. To see the difference, try using:
int* p1, p2; /* this will NOT declare two integer pointers! */
The correct syntax is:
int *p1, *p1;
...since the * says that what's on the right is a pointer.
Again, this misunderstanding wouldn't even come up with a right-unary dereference operator.
Most of the C language is admirable, particularly as a product of the early '70s, but this (along with allowing the <string.h> and parts of <stdio.h> libraries to become de facto standards) get my votes for Dennis Ritchie's biggest mistakes.
|
|
|
|
|
My mother-in-law had problems with the App "VoiceMail" from the german Telekom.
They called the hotline: "Oh, no problem, just deinstall and install it again, everything will work"...
Only that the new Version doesn't run in her phone because that Android version has been discontinued
And they don't offer the old ones... and neither can I find older versions in play store
After googling a bit I have found a site... apkpure.com
It looks like an "internet archive" for android software, they have a a list with almost 40 different past versions of this App and they offer the same for other stuff...
Do you know it / Have you used it??
Is it trustworthy? Or is a risk to get "something else" within the App?
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
I haven't used it, but ... it looks OK: The 5 Best Sites for Safe Android APK Downloads[^] - the site also lists other sites that may have the APK you wanted.
"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!
|
|
|
|
|
Thanks.
I have checked both, the signatures are the same in both places and match the downloaded file in both too.
BTW... the link you gave me looks like a nice site too. Do you use it regulary?
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
And suddenly I can see this message ... the hamsters have woken up.
It's not one I use often, but it's one of those "hmmm ... bookmark that one" sites you come across from time to time.
"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!
|
|
|
|
|
|
Read it properly and explains why: because it's pretty much the only source of installs on Android - 87% of all installs came from the Play Store, with the next highest source being just 5%! So it has a very good threat-to-legitimate app install ratio considering.
I don't have figures for Apple or MS, but I'll guess they are similar or worse. Amazon? I suspect they will be a lot worse.
"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!
|
|
|
|
|
Of course. There was a bit of cynicism in my post that--I don't blame you for it--didn't come through.
Everyone's making the claim their so-called stores are the only places that can be trusted. Reality shows an entirely different outcome.
|
|
|
|
|
... un plug the computer, Sandra!
|
|
|
|
|
I checked the site with Virus Total. It stated that some 80 plus virus engines all said the site was safe.
Get me coffee and no one gets hurt!
|
|
|
|
|
Thank you. Didn't think of it
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
I cut my teeth on a 6502 processor. 8 bit and 65536 bytes of RAM to play with. Later on I moved to 16 and finally 32 bit.
As computers get more sophisticated and accordingly more complicated looking back I realize part of me enjoys them less. Don't get me wrong - garbage collected code is great and not having to worry about out of memory exceptions on a modern OS under most circumstances is a huge win that I think many of us probably take for granted.
I like to bit twiddle though. Don't you? I liked it when I had to come up with something crafty to make it even work. It's a challenge, and it's more hacking than coding.
Recently, I had to change the timing in the driver code for a display I was using because it had never been coded for my IoT CPU.
Even with "higher level" network stuff like REST communication that element of hacking your way through without anything to spare is still there - the other day I had to roll my own HTTP chunked transfer encoding mechanism for batch uploading JSON data from an IoT device, because I didn't have enough RAM to load the logged data into memory so I could generate a Content-Length header for the upload.
All these little skills I picked up coding in the 80s for getting things done without much to work with basically atrophied after years of not only not using them but *avoiding* them.
We're not supposed to hack unless we have to.
We're not supposed to be "clever"
But here we are, full circle, with these little tiny SoC gadgets where it's all necessary again.
And I love it.
Real programmers use butterflies
|
|
|
|