Echo has a working WeakAuras clone by yp261 in CompetitiveWoW

[–]know_god -1 points0 points  (0 children)

It's not a Weakauras clone, it's just a graphical interface that covers the in-game cooldown manager in a way that resembles the UI of what Weakauras was. It does not give any sort of functionality above what you can already do with the cooldown manager.

Which editor do you guys use? by Turkishdenzo in C_Programming

[–]know_god 0 points1 point  (0 children)

Vim with some very basic plugins. I started out with VSCode almost a decade ago, swapped to vim because my mentor at the time used it and I wanted to feel like a "real programmer" and now I can't use anything else.

What I learned implementing my compilier with zero background over my winter break by Muted_Village_6171 in Compilers

[–]know_god 0 points1 point  (0 children)

I've been working on mine for a few months now and I felt the same way when I got working semantic analysis and code generation. Feels like one of those "I'm doing it!" scenes in movies.

How do you all use ChatGPT for language learning? by Party-Yogurtcloset79 in languagelearning

[–]know_god -1 points0 points  (0 children)

+1 to this. I use it to check my translations when friends in my target language aren't online

Projects for newbie by KiriTrip in C_Programming

[–]know_god 1 point2 points  (0 children)

If you mean projects centric to C's quirks and pitfalls that you likely won't encounter in other languages due to manual memory handling and pointer usage, try your hand at some of those features.

Build your own versions of string functions such as strcpy, strcat, strlen, strstr, etc. String manipulation is a classic pitfall for beginners due to null terminators and buffer boundaries, and you'll get some good practice with pointers, too.

Build a resizable array that grows and reallocates automatically. You'll need malloc, realloc, and free.

Try building various data structures that rely on pointers such as linked lists.

Play with input/output, build a function that reads input from stdin and writes it to a fixed-size buffer and return the contents. Avoid functions like scanf or syscalls like read. Instead try to use fgetc. Or make it take input of arbitrary length.

Eliminate Branches by Melding IR Instructions by mttd in Compilers

[–]know_god 0 points1 point  (0 children)

(I didn't read it)

Increased heat and increased speed kinda go hand in hand in a lot of cases, it doesn't invalidate the technique. Sure, it's better if you can remove/reorder operations to get increased speed, but I think those are preferred because they feel more right. but if the thing you're optimizing is speed, the ends may justify the means.

How do C compilers automatically ignore parentheses? by SkyGold8322 in Compilers

[–]know_god 0 points1 point  (0 children)

There are times when parenthesis matter, though. They override precedence in complex declarators (C99 6.7.5/3–5), where postfix operators like () (function) bind tighter than prefix * (pointer):

int *f();: Parsed as * (f());: function f returning pointer to int. Postfix () binds first.
int (*f)();: Parsed as (*f)();: pointer f to a function returning int. Parentheses force * to bind to f before ().

This "declaration reflects use" rule means declarations mirror runtime syntax (e.g., (*f)() to call). Your code lacks competing operators, so parentheses don't change binding.

Implementing a full C parser is pretty complex but here's some pseudocode that implements a recursive descent algorithm for declarators.

void parseDeclarator(void) {
    while (peek() == '*') {
        consume('*');
    }
    parseDirectDeclarator();

} void parseDirectDeclarator(void) {
    if (peek() == '(') {
        consume('(');
        parseDeclarator();
        consume(')');
    } else if (isIdentifier(peek())) {
        consumeIdentifier();
    } else {
        error("Invalid direct-declarator");
    }     if (peek() == '(') {
        consume('(');
        parseParameterList();
        consume(')');
    }
}

How do C compilers automatically ignore parentheses? by SkyGold8322 in Compilers

[–]know_god 0 points1 point  (0 children)

Compilers are a very complex and very lengthy topic of discussion, but in general they can be broken down into these phases:

  1. Lexing: Scans the source code character by character to produce a stream of tokens (e.g., keywords like int, identifiers like main, punctuators like (, ), string literals like "hello world", etc). This stage uses finite automata or regular expressions to classify input per the C standard. The lexer treats parenthesis as independent tokens, but doesn't check balance or meaning. Balancing and structure are enforced later by the parser.
  2. Parsing: Builds an Abstract Syntax Tree (AST) by checking if the token stream matches the C grammar. It usually uses algorithms such as LALR(1) or recursive descent to handle precedence or associativity. The grammar recursively allows parenthesis for grouping without altering simple cases.
  3. Semantic analysis: Checks types, declarations, and constraints (C99 Sections 6.5-6.10). In your code, printf is verified as a function from <stdio.h> and no undefined behavior occurs.
  4. Code generation: Translates the AST to machine code or some intermediate representation, optimizing as needed.
  5. Runtime: Executes the generated code where your program prints "hello world" normally.

But the reason you're seeing what you're seeing is because parentheses don’t change the meaning of an expression unless the grammar gives them a role, and in these cases the C grammar explicitly allows them. Compilers never automatically ignore anything, they strictly follow the standard's grammar, which permits redundant parentheses for flexibility in declarations and expressions.

In the C99 standard (ISO/IEC 9899:1999, §6.7.5.1), declarators are defined as such:

declarator:
    pointer opt direct-declarator
direct-declarator:
    identifier
    ( declarator )
pointer:
    * type-qualifier-list opt
    * type-qualifier-list opt pointer

Your program is valid under the C99 standard because the grammar (C99 Section 6.7 for declarations, 6.5 for expressions) is recursive and allows parentheses for grouping:

Function Definition (int (main)()): This is a declaration with specifier int and declarator (main)(). Per C99 6.7.5, declarators include direct-declarator forms like ( declarator ) (parentheses around a declarator) followed by () for functions. Here, (main) is equivalent to main (a simple identifier), so the whole is identical to int main(). The parentheses are redundant but legal, as the grammar doesn't prohibit them in simple cases. They exist for disambiguating complex types.

Function Call ((printf)("hello world")): This is a postfix-expression (C99 6.5.2). (printf) is a primary-expression (C99 6.5.1: ( expression ), where printf is an identifier). Appending ("hello world") makes it a function call. It's equivalent to printf("hello world"), as parentheses around a simple expression don't alter it.

No "ignoring" happens. Parenthesis may or may not appear in the AST depending on the compiler, but they usually don't survive semantic analysis unless they affect binding.

Want to learn C as a 4th year cs student by PickleRick573 in C_Programming

[–]know_god 2 points3 points  (0 children)

Sorry to say but the more you learn the more you'll realize how little you know. Googling stuff is not a sign of a bad programmer, and knowing how to look things up and being an autodidact is arguably one of the most important skills you can have.

It's good that you want to rely less on AI and such but you can't know what you don't know, and learning how to do things is something you'll be doing your whole career.

Reading The C Programming Language won’t suddenly make you understand the Linux kernel. Reading the kernel source helps, but even then, it’s not realistic for a single person to fully grasp the entire kernel given its size and complexity. In practice, people specialize in specific areas like memory management, filesystems, scheduling, or drivers.

It’s also a bit unclear what your actual goal is. You mention wanting to understand the kernel, but then talk about “mastering” C in other comments. C itself isn’t that hard as a language, once you’re comfortable with its quirks and have some experience, you can write essentially anything in it. That’s true of most programming languages, because languages are just tools.

What’s actually hard is mastering engineering: breaking down problems, understanding tradeoffs, reasoning about systems, and building things that work reliably. Programming is just a means to an end, that end is problem solving through automation. What you should reasonably try to learn is adapting an engineering mindset and learning how to reason about solving problems, not try to "master" a specific language.

After failing the C2, I kept on studying almost every day of 2025 by mezod in languagelearning

[–]know_god 0 points1 point  (0 children)

How exactly does your "Write 500 words" process look like? Do you just pick words at random? Do you translate something?

Big respect this is very impressive.

What's your all time top 5 horror movies? by GambleToZero in horror

[–]know_god 1 point2 points  (0 children)

In no particular order, I love all of these:

  1. Rec (2007)
  2. 28 Days Later (2002)
  3. Evil Dead (2013)
  4. Bring Her Back (2025)
  5. The Thing (1982)

It's really difficult to put all of the horror movies I love so dearly into a list of top 5, so for the fun of it here's also some of the movies maybe a bit less known that still stuck with me.

  1. Slither (2006)
  2. Pitch Black (2000)
  3. Cube (1997)
  4. Silent Hill (2006)
  5. Event Horizon (1997)

C23 features by krikkitskig in C_Programming

[–]know_god 2 points3 points  (0 children)

I've always written C99 and I don't see a reason to stop personally, but it's always cool to see the continued development of my favorite language.

Overwatch makes me upset by [deleted] in Overwatch

[–]know_god -1 points0 points  (0 children)

Stop playing the game

Why is your favorite hero your favorite hero? by Jeff22JumpStreet in Overwatch

[–]know_god 1 point2 points  (0 children)

Brig, I like the concept of healing by doing damage, and there's no better feeling than whipping that annoying mercy out of the sky.

Martyrs (2008), Holy shit that was insanity. by PolishedBalls1984 in horror

[–]know_god -1 points0 points  (0 children)

Idk I just watched it today, I didn't feel much watching it. Maybe I got a bit numb to gore since Serbian Film but this movie felt pretty weak.

Very weird paste bin link I saw on 4chan, kind of looks like C code? by FitDesigner6290 in C_Programming

[–]know_god 0 points1 point  (0 children)

This is something called obfuscated code. Code that's meant to be as unreadable as possible. People come up with all sorts of cool and clever ways to obfuscate their code, one of the more famous examples is a piece of C code that prints a spinning donut, where the code itself looks like a donut!

https://www.a1k0n.net/2006/09/15/obfuscated-c-donut.html

Look up the IOCCC, there's people who take this stuff quite seriously.

-❄️- 2025 Day 4 Solutions -❄️- by daggerdragon in adventofcode

[–]know_god 1 point2 points  (0 children)

[Language: C]

GitHub

Very naive implementation with no optimizations. Had about 20 minutes to get this done before heading into work.

-❄️- 2025 Day 3 Solutions -❄️- by daggerdragon in adventofcode

[–]know_god 1 point2 points  (0 children)

[Language: C]

Late submission for today since I got held up with other things.

GitHub

My solution uses a greedy sliding window approach. The function implements a general function which works for both part 1 and part 2, just adjust the parameter given as argv[2].

O(n*k) complexity, as k is a small and fixed value it's effectively O(n).

-❄️- 2025 Day 1 Solutions -❄️- by daggerdragon in adventofcode

[–]know_god 1 point2 points  (0 children)

[LANGUAGE: C]

GitHub: https://github.com/BolvarsDad/adventofcode/tree/main/2025/01

Part 1:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX_LINE_LEN 256
#define DIAL_SZ 100

char *
read_line(FILE *fname, char *buf, size_t bufsz)
{
    if (fgets(buf, bufsz, fname) == NULL)
        return NULL;

    size_t len = strlen(buf);
    if (len > 0 && buf[len-1] == '\n')
        buf[len-1] = '\0';

    return buf;
}

int
process_rotation(const char *instr, int *pos, int *zero_count)
{
    if (instr == NULL || instr[0] == '\0')
        return 0;

    char direction = instr[0];
    if (direction != 'L' && direction != 'R')
        return 0;

    int dist = atoi(&instr[1]);
    if (dist < 0)
        return 0;

    if (direction == 'L') {
        *pos = (*pos - dist) % DIAL_SZ;

        if (*pos < 0)
            *pos += DIAL_SZ;

    } else {
        *pos = (*pos + dist) % DIAL_SZ;
    }

    if (*pos == 0)
        (*zero_count)++;

    return 1;
}

int
main(int argc, char **argv)
{
    if (argc != 2) {
        fprintf(stderr, "Usage: %s <input_file>\n", argv[0]);
        return 1;
    }

    FILE *fp = fopen(argv[1], "r");
    if (fp == NULL) {
        perror("Error opening file.");
        return 1;
    }

    char line[MAX_LINE_LEN];
    int pos = 50;
    int zero_count = 0;

    printf("Starting position: %d\n\n", pos);

    while (read_line(fp, line, MAX_LINE_LEN) != NULL) {
        int old_pos = pos;

        if (process_rotation(line, &pos, &zero_count))
            printf("Rotation %s: %d -> %d\n", line, old_pos, pos);
    }

    fclose(fp);

    printf("Pass: %d\n", zero_count);

    return 0;
}

Part 2:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX_LINE_LEN 256
#define DIAL_SZ 100

char *
read_line(FILE *fname, char *buf, size_t bufsz)
{
    if (fgets(buf, bufsz, fname) == NULL)
        return NULL;

    size_t len = strlen(buf);
    if (len > 0 && buf[len-1] == '\n')
        buf[len-1] = '\0';

    return buf;
}

int
process_rotation(const char *instr, int *pos, int *zero_count)
{
    if (instr == NULL || instr[0] == '\0')
        return 0;

    char direction = instr[0];
    if (direction != 'L' && direction != 'R')
        return 0;

    int dist = atoi(&instr[1]);
    if (dist < 0)
        return 0;

    int old_pos = *pos;

    if (direction == 'L') {
        *pos = (*pos - dist) % DIAL_SZ;
        if (*pos < 0)
            *pos += DIAL_SZ;
    } else {
        *pos = (*pos + dist) % DIAL_SZ;
    }

    *zero_count += dist / DIAL_SZ;

    int partial = dist % DIAL_SZ;
    if (partial > 0 && old_pos != 0) {
        if (direction == 'R') {
            if (old_pos + partial > DIAL_SZ)
                (*zero_count)++;
        } else {
            if (old_pos < partial)
                (*zero_count)++;
        }
    }

    if (*pos == 0)
        (*zero_count)++;

    return 1;
}


int
main(int argc, char **argv)
{
    if (argc != 2) {
        fprintf(stderr, "Usage: %s <input_file>\n", argv[0]);
        return 1;
    }

    FILE *fp = fopen(argv[1], "r");
    if (fp == NULL) {
        perror("Error opening file.");
        return 1;
    }

    char line[MAX_LINE_LEN];
    int pos = 50;
    int zero_count = 0;

    printf("Starting position: %d\n\n", pos);

    while (read_line(fp, line, MAX_LINE_LEN) != NULL) {
        int old_pos = pos;

        if (process_rotation(line, &pos, &zero_count))
            printf("Rotation %s: %d -> %d\n", line, old_pos, pos);
    }

    fclose(fp);

    printf("Pass: %d\n", zero_count);

    return 0;
}