From 3b158194a8fe2ea49843303a78649e0f5fac1320 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 12 Oct 2017 09:48:47 -0700 Subject: 4028 --- html/subx/010core.cc.html | 8 ++++---- subx/010core.cc | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/html/subx/010core.cc.html b/html/subx/010core.cc.html index ce74e6e8..606d4dec 100644 --- a/html/subx/010core.cc.html +++ b/html/subx/010core.cc.html @@ -155,10 +155,10 @@ if ('onhashchange' in window) { 92 } 93 94 void load_program(const string& text_bytes) { - 95 // now, to read the hex bytes in ASCII, we'll use C's strtol - 96 // strtol needs a char*, so we grab the buffer backing the string object - 97 uint32_t addr = 1; - 98 char* curr = const_cast<char*>(&text_bytes[0]); // non-standard approach, but blessed by Herb Sutter (http://herbsutter.com/2008/04/07/cringe-not-vectors-are-guaranteed-to-be-contiguous/#comment-483) + 95 uint32_t addr = 1; + 96 // we'll use C's 'strtol` to parse ASCII hex bytes + 97 // strtol needs a char*, so we grab the buffer backing the string object + 98 char* curr = const_cast<char*>(&text_bytes[0]); // non-portable, but blessed by Herb Sutter (http://herbsutter.com/2008/04/07/cringe-not-vectors-are-guaranteed-to-be-contiguous/#comment-483) 99 char* max = curr + strlen(curr); 100 while (curr < max) { 101 ¦ // skip whitespace diff --git a/subx/010core.cc b/subx/010core.cc index bb3919cf..d71df322 100644 --- a/subx/010core.cc +++ b/subx/010core.cc @@ -92,10 +92,10 @@ void run(const string& text_bytes) { } void load_program(const string& text_bytes) { - // now, to read the hex bytes in ASCII, we'll use C's strtol - // strtol needs a char*, so we grab the buffer backing the string object uint32_t addr = 1; - char* curr = const_cast(&text_bytes[0]); // non-standard approach, but blessed by Herb Sutter (http://herbsutter.com/2008/04/07/cringe-not-vectors-are-guaranteed-to-be-contiguous/#comment-483) + // we'll use C's 'strtol` to parse ASCII hex bytes + // strtol needs a char*, so we grab the buffer backing the string object + char* curr = const_cast(&text_bytes[0]); // non-portable, but blessed by Herb Sutter (http://herbsutter.com/2008/04/07/cringe-not-vectors-are-guaranteed-to-be-contiguous/#comment-483) char* max = curr + strlen(curr); while (curr < max) { // skip whitespace -- cgit 1.4.1-2-gfad0