u/SeaInformation8764

C++ learning resources for someone who already knows a lot of C?

I wanted to get into C++ programming since I have bene programming in C for a while now, are there any good videos or resources tailored specifically to someone in a situation similar to this?

reddit.com
u/SeaInformation8764 — 1 day ago

Why Don't Double void Pointers Match Like Single void Pointers?

In the following code, calling test1 doesn't provide a warning, but calling test2 does. Is there a specific reason for this behavior?

void test1(void* x);
void test2(void** x);

int main() {
    int* x1;
    int** x2;

    test1(x1); // ok
    test2(x2); // warning "incompatible pointer type"
}

Edit: I think some people don't understand. I'm asking why void** doesn't match with other x**, not why it doesn't work exactly the same as void*.

reddit.com
u/SeaInformation8764 — 2 days ago

Is it Possible to not Evaluate 'f' Here?

#include <stdio.h>

int main() {
    int n = 5;
    int (*(*f)())[n];
    printf("%zu\n", sizeof *(f()));
    // sizeof(int) * 5
}

f is a function that returns a pointer to a VLA, is it possible to size that VLA without calling f?

cppreference

>If the type of expression is a variable-length array type, expression is evaluated and the size of the array it evaluates to is calculated at run time.

reddit.com
u/SeaInformation8764 — 8 days ago

Max RC but Other Ratings Low?

I've always noticed my RC rating getting really high, but now its at 99 even though my other ratings are high 70s to low 80s. Why does RC rise faster than the others?

reddit.com
u/SeaInformation8764 — 15 days ago

Super Small xxd Clone

I wanted to show off this little snippet where I use some of the cool formatting tricks from printf to create a simple xxd clone

#include <stdio.h>

int main(int argc, char** argv) {
    if(argc != 2) return fprintf(stderr, "usage: %s <file>\n", *argv), 1;

    FILE* file = fopen(argv[1], "r");
    if(!file) return perror("xxd"), 1;

    for(size_t o = 0; !feof(file); o += 16) {
        char s[16], i = 0;
        printf("%08zx: ", o);
        for(int c; i < 16 && (c = fgetc(file)) != EOF; i++) {
            s[i] = c >= 32 && c < 127 ? c : '.';
            printf("%02hhx%c", c, ' ' * (i & 1));
        }
        printf("%*.*s%.*s\n", (17 - i) * 10 / 4 - 1, 0, s, i, s);
    }
}

From what I have tested, it works almost identically to base xxd.

gist.github.com
u/SeaInformation8764 — 15 days ago
▲ 38 r/rust

Specifically, if I have a std::str::Chars iterator, how can I get a string slice using a method like .collect().

eg.

let chars = "12345 lalala".chars();
// something like this
let number_part: &str = chars.take_while(|&c| c.is_whitespace()).collect();

Or is this something you would need custom iterator functionality for?

reddit.com
u/SeaInformation8764 — 19 days ago
▲ 12 r/cobol

Hello, I will be joining Virginia Tech in the upcoming 2026 fall semester as a freshmen and I have started to dive into programming in COBOL after seeing multiple videos and articles calling for new developers. I also saw many COBOL jobs happened to be within government agencies which I would be close to living on campus in Virginia. At the moment I have been through a couple basic tutorials and can make pretty basic CLI programs using the gnu COBOL compiler, occasionally peeking back at references to remember syntax.

I have been programming since the beginning of middle school (~7-8 years) and have slowly worked my way from higher level languages like JavaScript and Java down to recently my favorite, C. I want to try to get myself into the industry early because I feel like I have a lot of the theoretical skills from building projects in many different languages and on many different systems over the years, and, because I want to keep learning new languages and systems, this seems like the perfect opportunity.

If possible, I would love to know the different technologies I should be researching to follow this path, or if there is a better stepping stone I should get into before trying to make this jump.

reddit.com
u/SeaInformation8764 — 25 days ago