Skip to content

Commit 3bf582c

Browse files
committed
Update Makefile and comments in C files for clarity and compatibility
- Enhanced the clean target in the Makefile to provide feedback on removed files. - Updated comments in setbits.c, invert.c, and rightrot.c to improve readability and maintain compatibility with C89/C99 standards. - Adjusted comment formatting in dcl.c for better clarity on function parameter declarations.
1 parent 967e279 commit 3bf582c

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ format-check:
2424
check: format-check lint
2525

2626
clean:
27-
rm -rf $(EXECS) $(DEBUG_FILES)
27+
@for f in $(EXECS) $(DEBUG_FILES); do \
28+
if [ -e "$$f" ] || [ -d "$$f" ]; then \
29+
rm -rf "$$f" && echo "Removed: $$f"; \
30+
fi; \
31+
done
2832

2933
.PHONY: all lint format format-check check clean

chapter_2/exercise_2_06/setbits.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
unsigned int setbits(int x, int p, int n, int y);
1111

1212
int main(void) {
13-
// Using hexadecimal instead of binary literals (0b...) for C89/C99 compatibility
14-
// 0xFF = 0b11111111, 0x06 = 0b0110
13+
// Using hexadecimal instead of binary literals (0b...) for C89/C99
14+
// compatibility 0xFF = 0b11111111, 0x06 = 0b0110
1515
unsigned int x = 0xFF;
1616
unsigned int y = 0x06;
1717

chapter_2/exercise_2_07/invert.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
unsigned int invert(int x, int p, int n);
1111

1212
int main(void) {
13-
// Using hexadecimal instead of binary literals (0b...) for C89/C99 compatibility
14-
// 0xD7 = 0b11010111
13+
// Using hexadecimal instead of binary literals (0b...) for C89/C99
14+
// compatibility 0xD7 = 0b11010111
1515
unsigned int x = 0xD7;
1616

1717
printf(BYTE_TO_BINARY_PATTERN, BYTE_TO_BINARY(x));

chapter_2/exercise_2_08/rightrot.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ void printbin(unsigned int x);
55
unsigned int rightrot(unsigned int x, unsigned int n);
66

77
int main(void) {
8-
// Using hexadecimal instead of binary literals (0b...) for C89/C99 compatibility
9-
// 0xF5 = 0b11110101
8+
// Using hexadecimal instead of binary literals (0b...) for C89/C99
9+
// compatibility 0xF5 = 0b11110101
1010
unsigned int x = 0xF5;
1111

1212
printbin(x);

chapter_5/exercise_5_18/dcl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
#define MAX_TOKEN_LEN 100
77
#define MAX_OUT_LEN 1000
88

9-
// Using (void) instead of () explicitly declares these functions take no parameters
10-
// This is the preferred modern C style and avoids compiler warnings
9+
// Using (void) instead of () explicitly declares these functions take no
10+
// parameters This is the preferred modern C style and avoids compiler warnings
1111
void skip_blanks(void);
1212
void skip_comments(void);
1313

0 commit comments

Comments
 (0)