[ / / / / / / / / / / / / / ] [ dir / random / 93 / biohzrd / hkacade / hkpnd / tct / utd / uy / yebalnia ]

/prog/ - Programming

Programming
Name
Email
Subject
REC
STOP
Comment *
File
Password (Randomized for file and post deletion; you may also set your own.)
Archive
* = required field[▶Show post options & limits]
Confused? See the FAQ.
Options

Allowed file types:jpg, jpeg, gif, png, webp,webm, mp4, mov
Max filesize is16 MB.
Max image dimensions are15000 x15000.
You may upload5 per post.


f0f016 No.5133

Discuss and share C related talks here. K&R, Ansi/ISO, C99, C11, embedded are all welcome.

____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

f80f5c No.5163

I fucking love pointers

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

e78739 No.5164

>>5163

value semantics are better tbh. certainly they are more efficient at runtime.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

767333 No.5166

CS:App is a great book on C/asm here: http://csapp.cs.cmu.edu/

There's an entire CMU course for it here with excellent lectures http://www.cs.cmu.edu/~./213/schedule.html (click on 'old video')

I recommend buying a used version, and not the international cheap version as it's fucking filled with mistakes due to it being printed in Indonesia or some bullshit.

This book shows you C pointers at the assembly level, and also contains awesome labs like the Attack Lab, which covers ROP Return Oriented Programming, something they recently used to hack the fuck out of the AMD and Intel prediction algorithms. You basically string together statements in programs in order to return wherever you want. These labs if you grab them off the site have automarking scripts, so you'll know if you're doing it correctly.

CMU's 15-122 also covers programming via contract using C, so you can identify pre/post conditions of functions in C and verify they are correct https://www.cs.cmu.edu/~15122/schedule.shtml

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

156034 No.5167

>>5133

What do people use for compiling C in windows?

I'm about to test these:

http://www.bloodshed.net/download.html

https://orwelldevcpp.blogspot.com/2015/04/dev-c-511-released.html

I was hoping someone with experience would be able to share some insight on getting started. Also I already know about gcc for linux, but I'm after a windows solution.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

20c05b No.5168

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

b2b88b No.5170

>>5168

Thanks anon, any idea why "The C Programming Language" textbook uses main() and not int main()?

Every compiler I use seems to demand it and I would rather not if at all possible.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

b2b88b No.5171

>>5170

Never mind an anon on /tech/ questions todl me what I needed to know.

Apparently the old C89 standard of C relied on an implicit int, it's all well documented apparently.

https://en.wikipedia.org/wiki/C11_(C_standard_revision)

https://en.wikipedia.org/wiki/C99

https://en.wikipedia.org/wiki/ANSI_C#C89

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

05fd50 No.5174

Why hasn't anyone posted the single most important reference to the C language known, namely cppreference.com?

https://en.cppreference.com/w/c

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

156034 No.5176

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

767333 No.5188

Anybody interested in 'mission critical' C, see the Verifiable C book, as CompCert has a verified C compiler too http://vst.cs.princeton.edu/

The compiler is obviously slower than gcc due to low optimization but some interesting shit can be made here, like say a correct Ethereum VM.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

650b8e No.5208

>>5166

It seems these videos aren't available anymore.

I'll check youtube though.

*2 secs later*

Here they are: https://www.youtube.com/playlist?list=PLpIxOj-HnDsPZIJYO4U9f-xRI8bBadaso

By the way, did anyone read Modern C by Jens Gustedt? I'm a scrub (EE freshman) and found that book unapproachable.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

f0f016 No.5238

>>5208

Didn't read that book but I can suggest another one to AVOID:

C programming for the absolute beginner is absolute trash. I'm referring to the third edition and I'm assuming the others are just as bad.. It was once of those "google it yourself" scenarios in the end, however, their problems to "solve" at the end were not clear enough and indeed were unsearchable many times.. Like a beginner shouldn't face that much resistance. Fuck that book. I've had better luck reading C89 by Clayman.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

558f8f No.5239

im going to start using C for my college is there any good book i can use?

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

9b418b No.5241

>>5239

The C programming language 2e

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

696e80 No.5251

>>5239

As >>5241 said, K&R is still the book for learning C programming. Another good book is The C Primer Plus by Stephen Prata (But do not buy his C++ book called "C++ Primer Plus")

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

857cd7 No.5263

>>5239

Either K&R and use this playlist to follow up: https://www.youtube.com/watch?v=lFbNQ66tFQU&list=PLc-HIpQTAA83WlPGC8AaKcHIx12HMgTs4

or "C Programming: A modern approach".

I think I'd start with the 2nd book, K&R imho is needlessly cryptic and too smart for its own good. However, when you become a more seasoned programmer, it's worth it to give it a quick read.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

857cd7 No.5264

If you want to learn C read K&R. (or if you want a more holistic approach read Modern C: A modern approach)

Then, do CMU's 15-213: Introduction to Computer Systems. http://www.cs.cmu.edu/~./213/

The lectures are all here: https://youtu.be/tamj4B7OALc

The book you can get on libgen.io

It will teach you gcc/gdb/caches/assembly/arithmetic operations/virtual memory ect ect all in C and x86-64 assembly.

After go through the SEI Cert C coding standard https://wiki.sei.cmu.edu/confluence/display/c/SEI+CERT+C+Coding+Standard

Congrats you know C now and won't blow yourself up while programming stuff.

Good luck pal.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

2a68de No.5265

>>5264

>Modern C: A modern approach

sounds very modern

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

857cd7 No.5266

>>5265

I guess what brodie here meant to say was C Programming: A modern approach.

Modern C by jens gusted isn't for noobs imho.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

98b2e9 No.5273

>>5133

C would be better with multiple return values, since that makes sense at the assembly level. You routinely pass multiple arguments using CPU registers, why the fuck is only 1 register used for return values?

I wonder if luajit implements it that way?

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

123764 No.5275

>>5273

C would be better with a whole load of things, but there's always someone to tell you C is a perfect language and there's no way to improve anything at all.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

dd196f No.5276

>>5273

Why would you need multiple return itmes? If you are passing that much data back and forth there are better ways. Global variables are frowned on, but there are ways to make it work well. You can group your status/info/pointers/flags into a local or global struct, and then just treat the information like an object. Subroutines should return things like flags, true/false, or values.. KISS.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

23e217 No.5284

>>5273

return a struct.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

abd724 No.5286

can someone explain ALL the uses for the -> operator?

i'm trying to learn OpenGL|ES 2.0 for the raspberry pi and don't really know what the fuck i'm doing besides reading K&R once and the code example here ( https://github.com/Apress/raspberry-pi-gpu-audio-video-prog/blob/master/EGL/window.c ) repeatedly uses the arrow operator from a struct to its members, whereas K&R and other resources I've found say it's only supposed to be used for a pointer to a struct to access members.

so for example, if you have a struct s and a pointer to struct s as ptr_s, and the struct has members x and y, what does s->x even do? shouldn't it only be s.x or ptr_s->x?

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

abd724 No.5287

>>5286

nevermind, i'm an absolute nigger monkey. the naming conventions are just horrible in this code, it really is the struct's pointer being passed to a different function and then used with the same name as the main struct. global variables can swallow fat loads.

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

791e11 No.5289

>>5167

digital mars has FIRE c++ compiler for windows... high recommend it. Everyone @ rockstar games uses it :)

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

791e11 No.5290

GCC: GNU's C compiler, available for almost every platform, and popularly installed on Unix machines.

Digital Mars C/C++: The hackers at Digital Mars have a pretty rippin' C/C++ compiler for Windows that you can download and use for free, and that will work wonderfully for all the code presented in this guide. I highly recommend it.

VC++: Microsoft's Visual C++ for Windows. This is the standard that most Microsoft programmers use, and I freaking hate it. Nothing personal, but I'm one of those crazy people that still uses vi.

Turbo C: This is a classic compiler for MSDOS. It's downloadable for free, and I has a special place in my heart. (It can't handle the "//"-style comments, so they should all be converted to "/**/"-style.)

cc: Virtually every Unix system has a C compiler installed, and they're typically and merely named cc (C Compiler, see?) Just try it from the command line and see what happens!

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

791e11 No.5291

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.



[Return][Go to top][Catalog][Nerve Center][Random][Post a Reply]
Delete Post [ ]
[]
[ / / / / / / / / / / / / / ] [ dir / random / 93 / biohzrd / hkacade / hkpnd / tct / utd / uy / yebalnia ]