Last active
August 29, 2015 14:19
-
-
Save loopj/47c1f52dfc49435a8e12 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Works | |
class Something { | |
public: | |
void doSomething() { | |
uint8_t buffer[1024]; | |
memcpy(buffer + bufferPosition, something); | |
bufferPosition += someSize; | |
memcpy(buffer + bufferPosition, something); | |
bufferPosition += someSize; | |
bufferPosition = 0; | |
} | |
private: | |
uint8_t bufferPosition = 0; | |
} | |
// Doesn't work | |
class Something { | |
public: | |
void doSomething() { | |
memcpy(buffer + bufferPosition, something); | |
bufferPosition += someSize; | |
memcpy(buffer + bufferPosition, something); | |
bufferPosition += someSize; | |
bufferPosition = 0; | |
} | |
private: | |
uint8_t buffer[1024]; | |
uint8_t bufferPosition = 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment