My textbook tells me there is a operator for bitwise rotation in C23 (<<<), is there?
My textbook tells me there is a operator for bitwise rotation in C23 (<<<), is there?
Not sure if I'm tripping right now... but there does not seem to be one right? Still new to C so I might miss something super obvious. All my searches on the web result in just examples using shift operators to recreate a roll operator. Book is in German but I hope the example is clear enough. It basically tells me I can use <<< and >>> to rotate bits in C23 and up. image Using gcc with --std=c23 results in this error during compilation:
error: expected expression before
<=token
c
#include "stdio.h"
int main(void) {
unsigned char C=0x80;
C<<<=1;
printf("C=%d\n", C);
return 0;
} I am also unsure why its written in the example like C<<<=1; I would have expected C<<<1;.
It is not listed in the cppreference and the book even goes on responding to a readers letter who described another problem like the operator in itself actually exists... I'm so confused right now ;(
EDIT: Ok, it does seem to just not exist... thank you @lime@feddit.nu for keeping me sane. I have just sent out an email to the authors to ask for their explanation.
Comments (12)