blog: store registration check [programming]

Discussion & Support for xplorer² professional

Moderators: fgagnon, nikos, Site Mods

dunno
Gold Member
Gold Member
Posts: 518
Joined: 2007 Nov 18, 03:00
Location: Tropical Hammock

Re: blog: store registration check [programming]

Post by dunno »

I hastily withdrew my left toe from the murky water of code when I stumbled across "pointers", I really tried to make sense of why one must have a address for a address, I don't get why a variable must be pointed to, surely that wastes pc time and bloats the software.

Pardon my ignorance and do consign me to my hammock if the answer is beyond me, but there's this nagging sense of failure at not understanding the same address for the same address.
Tuxman
Platinum Member
Platinum Member
Posts: 1683
Joined: 2009 Aug 19, 07:49

Re: blog: store registration check [programming]

Post by Tuxman »

If something does not point to a memory address, it does not exist. :)
Tux. ; tuxproject.de
registered xplorer² pro user since Oct 2009, ultimated in Mar 2012
Kilmatead
Platinum Member
Platinum Member
Posts: 4802
Joined: 2008 Sep 30, 06:52
Location: Baile Átha Cliath

Re: blog: store registration check [programming]

Post by Kilmatead »

dunno wrote:...surely that wastes pc time and bloats the software.
Actually, the opposite is true - pointers are there to save memory and to speed things up, largely because they severely reduce the duplication of data involved, and provide granular access to it in ways the "normal" variables don't/can't. As Tuxman vaguely pointed out through the haze of his hangover, everything in the computer is just address-space in the first place, so languages need some means of referring to it (directly) in order to manipulate it efficiently.

Granted, if you're only talking about a few integer variables this doesn't matter much, as there's only a few bytes involved in the first place. However, expand out into how data is organised into structures (struct/union, etc), arrays of structures, pseudo-strings... and things can get exponential pretty fast.

You have to realise that this stuff is highly language-specific, so answers can vary greatly, as some languages don't really use pointers at all (~ C#), or at the very least don't explicitly call them such, and use abstract terms like "pass by reference" instead. One of the reasons for this is that pointers are really really easy to screw up (which is why they are also so powerful), but "newer languages" are all about protecting the programmers from stubbing their toes on the coffee-tables, and so tend to hide the dirty business like child-proofing a house. Great for keeping kids safe, annoying for grown-ups who can understand quantum-mechanics in their heads yet get flummoxed by a child-proof bleach-bottle cap.

Anyway, if you google it, there's probably about 18 billion tutorials on pointers available, so sooner or later you'll find one that makes sense. (Curiously, if you type in "pointers for dummies" you don't get as much useful information as I would have expected. Then again, Google is its own child-proof cap, so such is the world. :D)
Tuxman
Platinum Member
Platinum Member
Posts: 1683
Joined: 2009 Aug 19, 07:49

Re: blog: store registration check [programming]

Post by Tuxman »

Kilmatead wrote: 2017 Feb 22, 10:39 Granted, if you're only talking about a few integer variables this doesn't matter much, as there's only a few bytes involved in the first place.
But you don't always know how many bytes those are. A byte does not have to have 8 bits, numbers are even more obscure. :shrug: Know your <limits>.
Tux. ; tuxproject.de
registered xplorer² pro user since Oct 2009, ultimated in Mar 2012
Kilmatead
Platinum Member
Platinum Member
Posts: 4802
Joined: 2008 Sep 30, 06:52
Location: Baile Átha Cliath

Re: blog: store registration check [programming]

Post by Kilmatead »

Tuxman wrote:A byte does not have to have 8 bits, numbers are even more obscure.
True, nothing is ever what it seems (or often even stranger than we were taught) but don't muddy the waters with edge-cases - your man's just asking a standard question. :wink:

if (sizeof(Tuxman_Ego) > (BitsperByte & 1) || (BitsperByte % 2)) Eat_Kilmatead_Boot(Left);
Tuxman
Platinum Member
Platinum Member
Posts: 1683
Joined: 2009 Aug 19, 07:49

Re: blog: store registration check [programming]

Post by Tuxman »

Answering a standard question with information which is true most of the time will lead to unforeseen issues rather sooner than later. You can't know too much about the wirings of a CPU. Granted, modern programming :roll: usually ignores platforms and happily abstracts your computer largely enough to leave a shadow behind. Working with shadows is accessible but it looks more like magic. I mean, knowing what your code does is overrated, right? At least it's not among the things you're taught during programming studies. You talk to your compiler, not to your computer, and your compiler knows what's good for you...

It was a horrible idea to invent high-level languages.
Tux. ; tuxproject.de
registered xplorer² pro user since Oct 2009, ultimated in Mar 2012
Kilmatead
Platinum Member
Platinum Member
Posts: 4802
Joined: 2008 Sep 30, 06:52
Location: Baile Átha Cliath

Re: blog: store registration check [programming]

Post by Kilmatead »

Tuxman wrote: 2017 Feb 22, 11:14You can't know too much about the wirings of a CPU.
Again true, but there is a limit to how practical that knowledge is and whether it helps or hinders.

Walk into your favourite computer-shop and ask the work-experience kid whether quantum tunnelling is going to mess with the algorithms you depend upon to encode your Alpaca-farmer porn collection, and he wouldn't be wrong to answer either Yes or No or (even better) both-at-the-same-time.

So yeah, you can actually know too much about the wirings of a CPU. Just because something is true doesn't make it real.
Tuxman
Platinum Member
Platinum Member
Posts: 1683
Joined: 2009 Aug 19, 07:49

Re: blog: store registration check [programming]

Post by Tuxman »

Kilmatead wrote: 2017 Feb 22, 11:27 there is a limit to how practical that knowledge is and whether it helps or hinders.
That limit mainly depends on whether you are focusing on efficiency or quick results, RAD or unmanaged code; which, in turn, depends on whether you have an impatient customer or you want to waste your free time by writing code just for your own amusement.
Tux. ; tuxproject.de
registered xplorer² pro user since Oct 2009, ultimated in Mar 2012
Kilmatead
Platinum Member
Platinum Member
Posts: 4802
Joined: 2008 Sep 30, 06:52
Location: Baile Átha Cliath

Re: blog: store registration check [programming]

Post by Kilmatead »

Existentially speaking (is there any other way?), all code is written for personal amusement, whether you bequeath it to an impatient customer or the faceless corporate entity which claims copywrite over everything you create while in their employ. The self-conscious and solipsistic mind places value in the ratio of the integrity vs. effort it takes create something for the ever-grasping public; the conscientious mind just creates quality by the impulse of its own nature.

Speaking of which, for someone who claims to have a job, you seem to have an awful lot of free time to waffle about the blue skies and contribute to the lovely trashing of yet another of Nikos' threads. (Says the pot calling the kettle black.) :wink:
Tuxman
Platinum Member
Platinum Member
Posts: 1683
Joined: 2009 Aug 19, 07:49

Re: blog: store registration check [programming]

Post by Tuxman »

Kilmatead wrote: 2017 Feb 22, 12:09 Existentially speaking (is there any other way?), all code is written for personal amusement
I made the experience that I prefer to write code which I'm not paid for; those with the paycheques are also those with the least interesting ideas. I'm always looking forward to the end of the working day so I can finally stop writing boring code for boring projects and continue writing slightly less boring code which nobody will ever care about.
I stopped using PHP for my personal projects when I found someone to pay me for it because PHP suddenly lost its sexyness instantly. I try not to suggest a language I like to my employer anymore.
Kilmatead wrote: 2017 Feb 22, 12:09 Speaking of which, for someone who claims to have a job, you seem to have an awful lot of free time to waffle about the blue skies and contribute to the lovely trashing of yet another of Nikos' threads.
That is because I don't have to think too much about most things written here; it's chilling to just exchange random thoughts without considering the correlations. Sorry if I accidentally stayed on-topic anywhere.
Tux. ; tuxproject.de
registered xplorer² pro user since Oct 2009, ultimated in Mar 2012
Kilmatead
Platinum Member
Platinum Member
Posts: 4802
Joined: 2008 Sep 30, 06:52
Location: Baile Átha Cliath

Re: blog: store registration check [programming]

Post by Kilmatead »

'Tis anathema to stay on topic around here, that's why I haunt the streets; it's hard work striving to be anything other than an honorary member of the proletariat. :D

PHP had sexiness to begin with? This coming from the lad with a pronounced LISP? And they say I suffer an overactive imagination!
Tuxman
Platinum Member
Platinum Member
Posts: 1683
Joined: 2009 Aug 19, 07:49

Re: blog: store registration check [programming]

Post by Tuxman »

PHP's unique selling point - if you ever come across a businessman, run before he speaks - is that you can just place it on (almost) any cheap web server and everything is already there. Try that with Lisp! (Of course I wrote a simple web service in Lisp once, but it requires significantly more preparation than the next best PHP guestbook. Ha, guestbooks - do people still do that?)
Tux. ; tuxproject.de
registered xplorer² pro user since Oct 2009, ultimated in Mar 2012