3 ms·
> fun aside, name and service are both const char* so I find it funny that they are set in the program, I do understand that from the callers perspective they d
by Xcelerate 11y ago
> fun aside, name and service are both const char* so I find it funny that they are set in the program, I do understand that from the callers perspective they don't change, but still bad form
Correct me if I'm wrong (I haven't programmed in C++ in forever), but aren't "name" and "service" pointers to constant arrays of characters rather than constant pointers to (mutable) arrays of characters? In the first case, you're saying you have a variable that points to a memory location; the variable itself can be changed, but the data in memory at that location cannot. In the second case, you're saying that you cannot change the variable that contains the memory address; however, you can change the data in memory at that location.
(And if I remember correctly, I believe there are also such things as constant pointers to constant memory...)
- mbrock 11y agohttp://cdecl.org/ http://cdecl.org/ const char *foo declares a pointer to a char that is constant. const char * const foo declares a constant pointer to a char that is constant.
- teddyh 11y agoYou know, you could just apt-get install cdecl And then do it on the command line. But hey, let's turn everything into a web service, with NSA et al. monitoring as a bonus feature.
- deleted 11y ago[deleted]