Yep, that's all correct.
The compiler will assign registers to your other variables however it feels like it (they don't have to be listed in order).
You've just got to be careful if you've got shaders that don't use the viewMatrix variable (for example).
// Vertex shader:
float myVar; //uh oh, might be put in c0
float anotherVar; //might be put in c1
When you set myVar/anotherVar on the C++ side for this shader, you (might/will) be writing into c0/c1, which previously held your viewMatrix. If the next shader assumes that the viewMatrix is already loaded into c0-c3, then it'll be in for a rude surprise!
So if you're going to use manual-register-assignment for some variables, and automatic-register-assignment for other variables, make sure you always include the 'manual' variables in your shaders, even if they're not used (put them in a header or something).
float4x4 viewMatrix : register(c0);//not used in this shader
float myVar;
float4 vs_main( float4 pos : POSITION ) : POSITION
{
return pos * myVar;
}As you can see, even though viewMatrix isn't used, it still influences the automatic register assignment, with myVar ending up in c4:
// fxc /Tvs_3_0 /Evs_main test.hlsl
//
// Parameters:
// float myVar;
//
// Registers:
// Name Reg Size
// ------------ ----- ----
// myVar c4 1
//
vs_3_0
dcl_position v0
dcl_position o0
mul o0, c4.x, v0