News for hackers. Stuff that matters.
Re:Declaring C String Constants by carlsonmark on Wednesday May 17, 2017 @02:08PM (#14361084)
While I do enjoy this sort of analysis, I feel the decision to choose one method over another should be based on benchmarks (preferably with more than one size of string.) After benchmarking, then do an analysis of the assembly code.

Guessing about pipelining, memory access times, and the effect of generated code size is much less valuable than real measurements.

Re:Declaring C String Constants by a_t48 on Wednesday May 17, 2017 @02:21PM (#14361240)
Beyond this,

  &ptr
and

  &arr
are different types! The signature for

  bogus(arr, &arr)
is something like

  void bogus(const char* arg1, const char (*arg2)[12])
While they do point to the same data, it's pretty rare to actually want to declare a

  const char (*)[N]
as a function argument - template magic code excepted, you don't gain much over a

  char *
and it's not the same as a

  char**
The two lines do different things, so of course they will generate different code. What do you know, the one that actually lets you do useful things is a few bytes longer.