The syntax for
\dimendef〈control sequence〉〈equals〉〈8-bit number〉
With e-TeX extensions the number can be 15-bit; with LuaTex it can be 16-bit. The purpose of
\dimendef is to define a control sequence that will refer to one of the available registers, not to set the value of some dimension register.
When you say
\newdimen\dA, TeX knows the last allocated register number, say n, and it will do
\dimendef\dA=n + 1
(in pseudocode). So, if the last allocated register is
\newdimen\dA will do
\dA will be equivalent to
\dimen43, but one doesn't need to know the actual number, which might change from one run to another, if the code changes with a new allocation beforehand.
If you do
\newdimen\dA, TeX allocates a new register number and sets it to 0pt (unless you have tampered with registers assigning to them directly by register number). If you do
the required 〈8-bit number〉 is coerced to be the value in scaled points of the register
\da, in this case 0. Indeed
However, this is clearly a misuse of the syntax. If you want to allocate a new register with the same value as
\dA, you have to do
144179 in scaled points. But even if the value in scaled points was in the allowed range, after
\dimendef\dA=\dB the newly defined register named
\dA would contain the value
The moral of the story is: never use
\dimendef directly, unless you want to define names for “local register”, but
- this must be done in a group;
- you have to make sure that the code doesn't do assignments to registers that may be the same as those you use locally;
- you don't do global assignments to the “local registers”.
Failure to comply with the above rules can lead to weird results.