diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-08-26 13:40:19 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-08-26 13:40:19 -0700 |
commit | 7fd010710c0a34ff103bec3fb271f0c207bfcc53 (patch) | |
tree | 710cec51fc102241ec540511a72a6ee4c52d3e87 /038new_text.cc | |
parent | 029a3bdf53b523eded91a30177affdcace3bb2a1 (diff) | |
download | mu-7fd010710c0a34ff103bec3fb271f0c207bfcc53.tar.gz |
3259
Prefer preincrement operators wherever possible. Old versions of compilers used to be better at optimizing them. Even if we don't care about performance it's useful to make unary operators look like unary operators wherever possible, and to distinguish the 'statement form' which doesn't care about the value of the expression from the postincrement which usually increments as a side-effect in some larger computation (and so is worth avoiding except for some common idioms, or perhaps even there).
Diffstat (limited to '038new_text.cc')
-rw-r--r-- | 038new_text.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/038new_text.cc b/038new_text.cc index b3635331..ad0bb99a 100644 --- a/038new_text.cc +++ b/038new_text.cc @@ -35,7 +35,7 @@ int new_mu_string(const string& contents) { // allocate an array just large enough for it int string_length = unicode_length(contents); //? Total_alloc += string_length+1; -//? Num_alloc++; +//? ++Num_alloc; int result = allocate(string_length+/*array size*/1); trace(9999, "mem") << "storing string refcount 0 in location " << result << end(); put(Memory, result, 0); @@ -124,7 +124,7 @@ int unicode_length(const string& s) { string read_mu_string(int address) { if (address == 0) return ""; - address++; // skip refcount + ++address; // skip refcount int size = get_or_insert(Memory, address); if (size == 0) return ""; ostringstream tmp; |