Hello guys I'm facing another problem, I'm working on single bits and extract data from ascii text. The problem is that the compiler gives me an error about the fact that casting a char (8 bits) to a 4 bit memory field may alter its value.
Obviously that's true but how could I overcome that error?
typedef struct {
struct {
unsigned int type: 4;
unsigned int uid: 8;
unsigned int operation: 4;
unsigned int reg: 16;
}header;
char *arg_nm;
} OWL_request;
The complete error:
error: conversion to 'unsigned char:4' from 'char' may alter its value [-Werror=conversion]
and this is the assignment
request.header.type = (char)(j[0]-65);
j
is *char
What I have to do is to get rid of the error without altering compiler flags