Skip to content

Instantly share code, notes, and snippets.

@LukeGary462
Created March 7, 2023 21:36
Show Gist options
  • Select an option

  • Save LukeGary462/c47771f6d496926f0fc6206d85977ca5 to your computer and use it in GitHub Desktop.

Select an option

Save LukeGary462/c47771f6d496926f0fc6206d85977ca5 to your computer and use it in GitHub Desktop.
c trigraph support
#include <stdio.h>
#include <stdint.h>
/** This is fun...
* Trigraph Replaces
*
* ??( [
* ??) ]
* ??< {
* ??> }
* ??/ \
* ??' ^
* ??= #
* ??! |
* ??- ~
*
*/
int main(void){
uint8_t myByte = 0x00;
uint8_t newValue = myByte??!1<<2;
printf("old: 0x%02X, new: 0x%02X\n", myByte, newValue);
myByte = newValue;
newValue&=??-(1<<2);
printf("old: 0x%02X, new: 0x%02X", myByte, newValue);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment