Live data from Hacker News

Learn C in Y Minutes

learnxinyminutes.com

51–60 of 81 posts

Re: Learn C in Y Minutes

#51
post #40
post #18

> Ah, C. Still the language of modern high-performance computing. Yet its major compilers are written in C++ nowadays, and C++ is the main language for GPGPU computing, including the memory model used by NVidia on their cards. I suggest some benchmarks updates to the author.

CUDA kernels look very much like C, you cannot use the STL and a bunch of other things. For practical purposes, it is C.

https://github.com/NVIDIA/libcudacxx

Re: Learn C in Y Minutes

#52

As a web developer, who mostly spends time with Go and Python, is there any benefits of learning C?

C is a low level language that compiles down directly to assembly. It is similar to Go in this regard, but is a bit lower level. You have to manage memory yourself and pointers in C are much more dangerous. Reasons to learn C would include: absolute performance needed maybe for say a Python C extension, kernel hacking, some other project you want to contribute to uses C. I think it’s good to at least play with C and…

> language that compiles down directly to assembly

Directly to machine code, not assembly.

Re: Learn C in Y Minutes

#53
> Constants are written in all-caps out of convention, not requirement

I wonder if there even is a language where something like this IS required. Most of the languages I know are case-sensitive yet the case doesn't mean anything specific in any of them, the case seemingly always is a matter of style.

Re: Learn C in Y Minutes

#54
post #49

Earlier quoted context omitted.

Writing correct C is REALLY hard and slow (strings, manual memory management, concurrency pitfalls). So the investment is not paying off unless you are writing highly performance critical backend services. What can pay-off is learning to read C. Node.js, Firefox, Postgres, Linux are all written in C/C++ so if you ever want to really understand what's going on or have to debug a nasty bug, then you will need to be abl…

> So the investment is not paying off unless you are writing highly performance critical backend services. You took it too far. C opens the door for today's embedded, like, you know, blinking an LED with some microcontroller.

Most people do that on Arduino which is as c++ as it gets, with templates, etc...

Re: Learn C in Y Minutes

#55
post #39

Earlier quoted context omitted.

For someone planning on learning C in the next couple of months (through K&R), do you have any advice on where to learn best modern practices afterwards?

I like Effective C: An Introduction to Professional C Programming https://nostarch.com/Effective_C but I would since I wrote it.

I like it too, very much so, to the point where I recommend it to people that find K. N. King's "C Programming: A Lengthy Approach" too intimidating. And I had nothing to do with writing it, as you obviously know.

My sincere thanks for the book.

Re: Learn C in Y Minutes

#57

As a web developer, who mostly spends time with Go and Python, is there any benefits of learning C?

C is a low level language that compiles down directly to assembly. It is similar to Go in this regard, but is a bit lower level. You have to manage memory yourself and pointers in C are much more dangerous. Reasons to learn C would include: absolute performance needed maybe for say a Python C extension, kernel hacking, some other project you want to contribute to uses C. I think it’s good to at least play with C and…

nitpick. I think C compiles directly to machine code. There's no intermediate step of compiling to assembly first.

Re: Learn C in Y Minutes

#58

> Constants are written in all-caps out of convention, not requirement I wonder if there even is a language where something like this IS required. Most of the languages I know are case-sensitive yet the case doesn't mean anything specific in any of them, the case seemingly always is a matter of style.

AFAIK Go uses this for symbol visibility (e.g. symbols starting with an upper-case letter are exported, lower-case are private symbols).

Re: Learn C in Y Minutes

#59
post #40

Earlier quoted context omitted.

CUDA kernels look very much like C, you cannot use the STL and a bunch of other things. For practical purposes, it is C.

To be fair, C++ just brings over templated wrappers around battle-tested C CUDA libraries like cuDNN, cuBLAS, etc.

CppCon 2019: Olivier Giroux “The One-Decade Task: Putting std::atomic in CUDA.”

https://www.youtube.com/watch?v=VogqOscJYvk

Future of ISO and CUDA C++

https://developer.nvidia.com/gtc/2020/video/cwe21284-vid

Thrust, the CUDA C++ template library

https://docs.nvidia.com/cuda/thrust/index.html

Optix, single-ray shader programming model using C++, and ray Tracing acceleration using RT Cores.

https://developer.nvidia.com/optix

Phew, so many wrappers yet to list.

Post reply on HN