• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Programming |OT| C is better than C++! No, C++ is better than C

Somnid

Member
Speaking of converting recursive functions, it's only possible to use trampolines if the function itself is tail recursive right? Like I've never seen an example of one that wasn't and I couldn't figure it out for a simple flatten function which lead me to believe this was the case.
 

Koren

Member
Speaking of converting recursive functions, it's only possible to use trampolines if the function itself is tail recursive right? Like I've never seen an example of one that wasn't and I couldn't figure it out for a simple flatten function which lead me to believe this was the case.
Well, trampoline use on tail-recursive functions is trivial, so it's normal that examples are based on this. But you can use trampolines for more things than just avoiding the risk there's no TRE.

I'd say that since you can transform any recursive function into a tail-recursive function, you basically can use trampoline for everything. But it will require sometimes a LOT of rewriting, and the result may not be efficient.
 

Kelsdesu

Member
Are there any good resources/recommendations for programming with HLA? The simpler the better.

I have "The Art of Assembly" currently and honestly this tuff is flying over my head.
 
Are there any good resources/recommendations for programming with HLA? The simpler the better.

I have "The Art of Assembly" currently and honestly this tuff is flying over my head.

HLA is not even a real programming language. It's a higher level version of assembly created in order to teach real assembly. Is your ultimate goal actually to learn assembly?
 

Kelsdesu

Member
HLA is not even a real programming language. It's a higher level version of assembly created in order to teach real assembly. Is your ultimate goal actually to learn assembly?


Yes my intent is to learn. I worded that wrong. Im a little lost on it.

My original strategy was to write something in C then write the equivalent assembly version, but goddamn. It aint easy, so hla.
 
I have a tech blog, and I had an idea of writing a series of articles explaining the basic history of programming and advanced usage of PCs, starting with one about about the Command Line Interface's history. Can anybody here recommend some good sources of information of that?
 
Yes my intent is to learn. I worded that wrong. Im a little lost on it.

My original strategy was to write something in C then write the equivalent assembly version, but goddamn. It aint easy, so hla.

Assembly is just kind of a mindfuck when you're first learning it. It's like saying "well duh, of course 3 + 7 is 10" and then someone asking you "yes, but why? Can you derive it from first principles?" and you don't even know where to begin because how can you get any more basic?

I heard some people like this book, but I haven't read it so I can't really say for sure.

Best advice I can give you is to just not think about translating C to assembly and vice versa. Think about it as a completely different beast. Just learn the instruction set, and learn how to address memory, learn about stack frames, and try to write trivial programs that, for example, loop from 1 to 10 printing each number on a new line, etc. Things like that.

Eventually when you start becoming more familiar, compile some simple C programs and then disassemble them in an advanced debugger that has mixed C / assembly source listings, and see if you can make sense of why each instruction was converted the way it does, or at least convince yourself that the assembly does in fact represent the C code shown.
 

Koren

Member
Assembly is just kind of a mindfuck when you're first learning it.
That's strange...

Maybe it's because I've begun with really early languages (such as Basic 1.0), but Assembly has always seemed the most natural thing to me, and the easiest language to learn.


Of course, there's plently of strange things if you want to optimize things (like the LEA dirty tricks on x86 to do fast multiplications), but still...
 
I don't think assembly has anything to do with 3 + 7 being 10. Assembly is a shorthand for cpu opcodes and addition is still a primitive.

I agree assembly was onerous but I dunno if that example was good :p
 
I don't think assembly has anything to do with 3 + 7 being 10. Assembly is a shorthand for cpu opcodes and addition is still a primitive.

I agree assembly was onerous but I dunno if that example was good :p

idk, the analogy works well for me. It's hard to turn "3+7 = 10" into a rigorous sequence of steps involving the peano axioms, just like it's hard to turn "while (x > 5) { printf("%d", x); }" into a series of 10 or 15 assembly language instructions that are detached from the bigger picture.

In a way, assembly language is like the "axioms" of machine code (i.e. the lowest level operations you can perform), and you have to string together long sequences of them to get results that you can reason about at a high level.
 

Somnid

Member
If you want to learn about assembly, build an emulator. The insanity around hyper specific instructions that optimize arcane tasks and the tetris-like arrangement of instructions to fit into opcodes is where the meat is.
 

Koren

Member
it's hard to turn "while (x > 5) { printf("%d", x); }" into a series of 10 or 15 assembly language instructions that are detached from the bigger picture.

I'm not sure it's that great an example, because
Code:
loop : cmp %eax, $5
       jg endloop

       push %eax
       push formatstring
       call printf
       add %esp, $4
       pop %eax

       jmp loop

endloop :
seems like a basic translation to me (the only tricky part is the call, but it's completely natural when you understand the calling stack)
 
I'm not sure it's that great an example, because
Code:
loop : cmp %eax, $5
       jg endloop

       push %eax
       push formatstring
       call printf
       add %esp, $4
       pop %eax

       jmp loop

endloop :
seems like a basic translation to me (the only tricky part is the call, but it's completely natural when you understand the calling stack)

Obviously it's a basic translation, but pointers are pretty simple too right? And yet somehow they're like the bane of CS 101 students' existance. Arithmetic in N is simple once you understand groups and rings :)

PS:
AT&T syntax is evil
 

Koren

Member
Obviously it's a basic translation, but pointers are pretty simple too right? And yet somehow they're like the bane of CS 101 students' existance.
Well... To be honest, it took me a lot of time to begin to understand why pointers seem difficult to many.

But after discussing with many, the ones that have troubles with pointers are the one that started algorithmics with some high-level languages that completely hide how things work.

I've encounter students that were killers in assembly and pointers and couldn't write ten lines in Java... but they avoided HL programming at first.

PS:
AT&T syntax is evil
:) I really don't mind... I'm curious about this, though ;)
 
:) I really don't mind... I'm curious about this, though ;)

It's not based in any kind of rationality. I just hate it. Like, WTF is this shit?

Code:
leal (%eax,%eax,2), %eax

percents everywhere hurting my eyes, a bunch of commas that provide no insight into what's going on. And then this:

Code:
leal 8(,%eax,4), %eax

I don't even know where to start with this? In intel syntax it's almost a mirror image of the previous example, but here it looks like a completely different construct. Nonsensical.
 

Corto Maltese

Neo Member
This may be a silly question but i'm gonna shoot.

For my assignment for academy i have to create database and fill it with some data and then write lot of queries. But i manage to fail at start..

While i create it in a query(its T-SQL by the way in SSMS) I get this error :

Directory lookup for the file "C:\Users\user\Desktop\TSQL\DB_ASSIG1.mdf" failed with the operating system error 5(Access is denied.).


I googled it and someone mentioned that i should run it by administrator, i did it and nothing changed.
Any tips?
 

Somnid

Member
This may be a silly question but i'm gonna shoot.

For my assignment for academy i have to create database and fill it with some data and then write lot of queries. But i manage to fail at start..

While i create it in a query(its T-SQL by the way in SSMS) I get this error :

Directory lookup for the file "C:\Users\user\Desktop\TSQL\DB_ASSIG1.mdf" failed with the operating system error 5(Access is denied.).


I googled it and someone mentioned that i should run it by administrator, i did it and nothing changed.
Any tips?

Make sure the file isn't read only and that your user has permissions to it. Also make sure that no other program (like a file scanner or whatever) has an open handle to it.

Usually SMSS creates databases in it's own directory. If you are using a backup of an existing database, do a restore.
 

theecakee

Member
This may be a silly question but i'm gonna shoot.

For my assignment for academy i have to create database and fill it with some data and then write lot of queries. But i manage to fail at start..

While i create it in a query(its T-SQL by the way in SSMS) I get this error :

Directory lookup for the file "C:\Users\user\Desktop\TSQL\DB_ASSIG1.mdf" failed with the operating system error 5(Access is denied.).


I googled it and someone mentioned that i should run it by administrator, i did it and nothing changed.
Any tips?

Make sure the file isn't read only and that your user has permissions to it. Also make sure that no other program (like a file scanner or whatever) has an open handle to it.

Usually SMSS creates databases in it's own directory. If you are using a backup of an existing database, do a restore.

Yeah it's pretty much what Somnid said.

Here is a Stack Overflow question that gives a lot of ways to fix it depending on your setup. https://stackoverflow.com/questions/18286765/sql-server-operating-system-error-5-5access-is-denied
 
Hey guys,

I've got a super interesting job opportunity and I'd like to learn how to use git/github. I don't need perfect knowledge, but I'd like to be able to use it. Do you guys know of any great resources to learn? I have some notions of how to use it and I have a github account, but I'd like to learn some more.

Thanks in advance!
 

theecakee

Member
Hey guys,

I've got a super interesting job opportunity and I'd like to learn how to use git/github. I don't need perfect knowledge, but I'd like to be able to use it. Do you guys know of any great resources to learn? I have some notions of how to use it and I have a github account, but I'd like to learn some more.

Thanks in advance!

Check out Try Git and then keep some git cheatsheet bookmarked for whenever you forget commands.
 

JeTmAn81

Member
Well... To be honest, it took me a lot of time to begin to understand why pointers seem difficult to many.

But after discussing with many, the ones that have troubles with pointers are the one that started algorithmics with some high-level languages that completely hide how things work.

I've encounter students that were killers in assembly and pointers and couldn't write ten lines in Java... but they avoided HL programming at first.


:) I really don't mind... I'm curious about this, though ;)

I was definitely super confused by pointers as an undergrad. And honestly I wouldn't consider myself a pointer master now, never having worked for a consistent amount of time in a language that employs them. But the concept is simple enough and easily relatable to a realworld analogue in a teaching setting (street addresses!).

For whatever reason I think the most confusing part may simply be the syntax. Referencing and derererencing operators have never seemed intuitive in the way they're used. Also, pointers are just poorly taught I think.
 
I probably need to get used to git at some point, but it just seems so backward to be typing stuff into a command console when I have a GUI interface I use every day with SVN for my job.

I'm the biggest GUI fanatic you'll ever find, but yea.. You don't fuck with another man's git. I will never use SVN again.
 

Koren

Member
I probably need to get used to git at some point, but it just seems so backward to be typing stuff into a command console when I have a GUI interface I use every day with SVN for my job.
There's plently of GUI interfaces for Git (and also shell integration like Tortoise) but personally, I don't understand why someone would favor a GUI to a CLI tool... Well, to each its own... I know I'm in the minority when I favor Hg over git. ;)
 

Lister

Banned
Regardless you should be familiar with how git works and git commands even if you do use a GUI, so you know how to handle situations where the GUI is inssuficient (and they do crop up from time to time) and understand what all the GUI settings/options actually do.

I like github desktop and SourceTree personally.
 

FreezeSSC

Member
Just wanted to say I started the unreal course on Udemy with C++ and I've been loving it so far. First time programming in C++ and really like how much easier it is to do things than in C.
 

Somnid

Member
Is there anything wrong with SVN or do you just find git better to use?

Git is trivial to branch and conflicts are resolved locally instead of on the server.

Just wanted to say I started the unreal course on Udemy with C++ and I've been loving it so far. First time programming in C++ and really like how much easier it is to do things than in C.

Which course? I might look at it if there's another $5 sale.
 

Antagon

Member
Is there anything wrong with SVN or do you just find git better to use?

Git is decentralized which makes it easier/faster to commit as there's no traffic with a remote repository until you specifically push/pull commits. It's also better at merging branches which makes it better for a CI workflow.

Downside is that Git has a bigger learning curve.
 

FreezeSSC

Member
Which course? I might look at it if there's another $5 sale.


https://www.udemy.com/unrealcourse/

First section is a basic C++ primer then you get into basic stuff in unreal which is where it really gets fun. Thankfully since I already have a basic understanding of programming I've been exploring and adding my own features to the example projects we've been doing and its pretty rewarding seeing your changes come to life instantly. I think I'm more productive here at home than I am at work LOL.
 

vypek

Member
https://www.udemy.com/unrealcourse/

First section is a basic C++ primer then you get into basic stuff in unreal which is where it really gets fun. Thankfully since I already have a basic understanding of programming I've been exploring and adding my own features to the example projects we've been doing and its pretty rewarding seeing your changes come to life instantly. I think I'm more productive here at home than I am at work LOL.

Days when I work from home always feel more productive to me. I'd love my job a lot more if it was a regular thing. First day back from vacation and I've gotten way less done than I wanted to. But I'd lose the opportunity to call people over to check something out that I've been working on. Although I guess there could be ways around there.
 

Pixeluh

Member
https://www.udemy.com/unrealcourse/

First section is a basic C++ primer then you get into basic stuff in unreal which is where it really gets fun. Thankfully since I already have a basic understanding of programming I've been exploring and adding my own features to the example projects we've been doing and its pretty rewarding seeing your changes come to life instantly. I think I'm more productive here at home than I am at work LOL.

Do you think it's worth buying for a programming newbie? I have one programming class under my belt, which used python. I've been told it's a pain in the ass to learn C++ but will have to learn it next spring anyways. Should I bite the bullet and purchase it?
 
Is there anything wrong with SVN or do you just find git better to use?

Svn couldn't do a merge to save its life. I remember the dreaded tree conflict which basically translates to "you're fucked". In git it's so easy to do just about everything, from reordering commits, to branching, merges are always very straightforward no matter how complicated, you can move around arbitrary commits almost as easily as copying files. Everything just works. Having multiple branches in svn requires having multiple copies of the source tree, which is patently ridiculous.
 

Jokab

Member
Is there anything wrong with SVN or do you just find git better to use?

Svn couldn't do a merge to save its life. I remember the dreaded tree conflict which basically translates to "you're fucked". In git it's so easy to do just about everything, from reordering commits, to branching, merges are always very straightforward no matter how complicated, you can move around arbitrary commits almost as easily as copying files. Everything just works. Having multiple branches in svn requires having multiple copies of the source tree, which is patently ridiculous.

Also companies are more and more moving away from old VCSs to stuff like Git. See 2017's Stack Overflow developer survey: https://insights.stackoverflow.com/survey/2017#development-practices (scroll down a bit). Almost 70% of respondents use Git.
 

Chris R

Member
Also companies are more and more moving away from old VCSs to stuff like Git. See 2017's Stack Overflow developer survey: https://insights.stackoverflow.com/survey/2017#development-practices (scroll down a bit). Almost 70% of respondents use Git.

I know, that's why I said I personally need to get on it and learn git at some point, I was just wondering if there was some critical flaw with SVN that would cause us to switch at work as well.

SVN ain't broke for us, so we will continue to use it for the time being I think.
 

FreezeSSC

Member
Do you think it's worth buying for a programming newbie? I have one programming class under my belt, which used python. I've been told it's a pain in the ass to learn C++ but will have to learn it next spring anyways. Should I bite the bullet and purchase it?

He does a lot of hand holding, although I feel he doesn't do a good job if you're absolutely new to programming as he just kinda breezes over some pretty complicated stuff like classes, but if you have knowledge of programming already then it really shouldn't be a problem, the first 52 videos are all about making a simple console program in c++ that you could literally follow along with him as he goes. He does put pauses in the video and challenges you to try to solve the problem on your own, then after the pause he goes and implements it himself in case you can't solve it. The videos are short ranging from probably 5 to 12 minutes so I usually try to hit at least 2-3 a day. The course starts off with making a really basic word guessing game in the console, then you move over to unreal and make a small game where you try to escape a room (very basic 4 walls and a door that opens when you step in a certain spot) then you go into making a first person shooter(just a open map with a gun and you eventually put targets on the map), then finally a very basic tank battle game. I just finished the room section and its been pretty fun So far, the console stuff was a little boring but once you get into unreal it so much more rewarding.
 

Koren

Member
Having multiple branches in svn requires having multiple copies of the source tree, which is patently ridiculous.
Though most people I know work with several copies when using git (at least for the current git version and their own branch).

Git is decentralized which makes it easier/faster to commit as there's no traffic with a remote repository until you specifically push/pull commits. It's also better at merging branches which makes it better for a CI workflow.
The main advantate I see is that you can commit non-working things (to be able to go back and forth should something bad happen), and only push them once it's working.

Also, when you're often cut from the internet, like me (wireless in bullet trains is only for the end of the year at best), it's handy to have a local repository.

Downside is that Git has a bigger learning curve.
If you're able to choose your tools, Hg is easier to learn coming from SVN than Git.

Philosophies differ (I prefer Hg's) but at least, you're getting the advantages of DCVS. Once you're at ease with one, basic operations on the other are easy.

The main drawback to Hg is GitHub is Git-only...
 
I probably need to get used to git at some point, but it just seems so backward to be typing stuff into a command console when I have a GUI interface I use every day with SVN for my job.

Most editors and IDEs have good Git integration for simple branch/stage/commit/pull/push (90% of your commands), and merge assist help if you hit conflicts. You should only need the command line for 5-10% of stuff (mostly rebase/cherry-pick and exotic merge options).

I don't want to live in a world without lightweight branches, complete local histories, and badass merging.
 

Koren

Member
You can seamlessly use Hg with Github with http://hg-git.github.io/
I know, I've even hg-git installed, and tested it on a couple git projects (as curiosity, I believe it's better to use the tool everyone uses in a project).

It make some sense if you want to use github. But it's still using a Hg client on a git repository, so if you prefer the Hg way of doing things with respect to rewrites, that's not satisfying...

And publishing code there helps Git, so as an Hg supporter, I'm reluctant to do this, even if I can. And yes, I know it's useful for job hunting, but well... I'm not hunting currently.

Not sure... I've seen whole threads about this on the internet, usually heated ones. It's apparently a common practice.

From what I understand (either I work alone, or with really clearly defined independant tasks) it's so that you can pull the current version on a regular basis without touching your working copy, so that you can check how things evolve.
 

Makai

Member
DElIxaRVYAEPXAU.jpg:large
.
 
I started programming 6 months ago. Finished my first semester in University, got good grades, surprisingly (first semester though is always easier, I suppose).
I'm always doubting myself, always afraid of increasing difficulty levels, of hitting a plateau, because I've never seen myself as being good with logic. So far it hasn't happened yet. So far, programming can be very entertaining and satisfying when things just work, and incredibly frustrating when it doesn't for hours. I wonder if the frustration and failings happen less and less the more experienced you get? I can't imagine the stress of not being able to solve a problem in a professional environment, with all that pressure.

I just got an internship as help desk. Payment is shitty, but I can't seem to get development internships right out of the gate and I heard that's the way to start, so I guess it's ok.
 

theecakee

Member
What do you think of SmartGIT? I like the extra graphical layer, which makes it more accessible. I don't have any bad experiences with it.

Haven't tried it myself, I've used Git Krakken though before which is similar. I like it, sometimes I guess I'm just used to the command line git and just end up using that but whatever floats your boat I'd say.

I started programming 6 months ago. Finished my first semester in University, got good grades, surprisingly (first semester though is always easier, I suppose).
I'm always doubting myself, always afraid of increasing difficulty levels, of hitting a plateau, because I've never seen myself as being good with logic. So far it hasn't happened yet. So far, programming can be very entertaining and satisfying when things just work, and incredibly frustrating when it doesn't for hours. I wonder if the frustration and failings happen less and less the more experienced you get? I can't imagine the stress of not being able to solve a problem in a professional environment, with all that pressure.

I just got an internship as help desk. Payment is shitty, but I can't seem to get development internships right out of the gate and I heard that's the way to start, so I guess it's ok.

I'm still in college as well, but entering my senior year and currently interning somewhere. I still frequently hit walls and get frustrated, but always ends up panning out somehow. I'm no like principal software engineer ofc, but I'd imagine it never ends. Actually the one senior software engineer guy I work with has been for a few weeks now hitting walls setting up these Docker containers. Guy has been programming since the 80s lol. So nah, not alone. Also check your school if they have help desk jobs there too. That's where I work during the year and love it. Congrats on the internship :)
 
From what I understand (either I work alone, or with really clearly defined independant tasks) it's so that you can pull the current version on a regular basis without touching your working copy, so that you can check how things evolve.

It's annoying doing git stash just to check on someone else's branch, so I approve of this.

Alternatively, just learn git stash.

EDIT: I hate C. And I hate C because I hate macros. When your language doesn't have any real concept of modularity you end up with metaprogramming nonsense. C++ was supposed to fix this, theoretically but... Anyway I wanted to review the UNIX errno's. So I thought, ok, I'm including errno.h. If I want to know what the errnos are I'll just cat /usr/include/errno.h.

Code:
#ifndef	_ERRNO_H

/* The includer defined __need_Emath if he wants only the definitions
   of EDOM and ERANGE, and not everything else.  */
#ifndef	__need_Emath
# define _ERRNO_H	1
# include <features.h>
#endif

__BEGIN_DECLS

/* Get the error number constants from the system-specific file.
   This file will test __need_Emath and _ERRNO_H.  */
#include <bits/errno.h>
#undef	__need_Emath

#ifdef	_ERRNO_H

/* Declare the `errno' variable, unless it's defined as a macro by
   bits/errno.h.  This is the case in GNU, where it is a per-thread
   variable.  This redeclaration using the macro still works, but it
   will be a function declaration without a prototype and may trigger
   a -Wstrict-prototypes warning.  */
#ifndef	errno
extern int errno;
#endif

#ifdef __USE_GNU

/* The full and simple forms of the name with which the program was
   invoked.  These variables are set up automatically at startup based on
   the value of ARGV[0] (this works only if you use GNU ld).  */
extern char *program_invocation_name, *program_invocation_short_name;
#endif /* __USE_GNU */
#endif /* _ERRNO_H */

__END_DECLS

#endif /* _ERRNO_H */

/* The Hurd <bits/errno.h> defines `error_t' as an enumerated type so
   that printing `error_t' values in the debugger shows the names.  We
   might need this definition sometimes even if this file was included
   before.  */
#if defined __USE_GNU || defined __need_error_t
# ifndef __error_t_defined
typedef int error_t;
#  define __error_t_defined	1
# endif
# undef __need_error_t
#endif

Welp, ok. I could run errno.h through the preprocessor I guess but I won't be excited by what I get.

EDIT: Clearly I don't know how to use the preprocessor because this gcc -E test.c isn't work:
Code:
# 1 "test.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "test.c"
# 1 "/usr/include/errno.h" 1 3 4
# 28 "/usr/include/errno.h" 3 4
# 1 "/usr/include/features.h" 1 3 4
# 410 "/usr/include/features.h" 3 4
# 1 "/usr/include/sys/cdefs.h" 1 3 4
# 441 "/usr/include/sys/cdefs.h" 3 4
# 1 "/usr/include/bits/wordsize.h" 1 3 4
# 442 "/usr/include/sys/cdefs.h" 2 3 4
# 1 "/usr/include/bits/long-double.h" 1 3 4
# 443 "/usr/include/sys/cdefs.h" 2 3 4
# 411 "/usr/include/features.h" 2 3 4
# 434 "/usr/include/features.h" 3 4
# 1 "/usr/include/gnu/stubs.h" 1 3 4
# 10 "/usr/include/gnu/stubs.h" 3 4
# 1 "/usr/include/gnu/stubs-64.h" 1 3 4
# 11 "/usr/include/gnu/stubs.h" 2 3 4
# 435 "/usr/include/features.h" 2 3 4
# 29 "/usr/include/errno.h" 2 3 4






# 1 "/usr/include/bits/errno.h" 1 3 4
# 24 "/usr/include/bits/errno.h" 3 4
# 1 "/usr/include/linux/errno.h" 1 3 4
# 1 "/usr/include/asm/errno.h" 1 3 4
# 1 "/usr/include/asm-generic/errno.h" 1 3 4



# 1 "/usr/include/asm-generic/errno-base.h" 1 3 4
# 5 "/usr/include/asm-generic/errno.h" 2 3 4
# 1 "/usr/include/asm/errno.h" 2 3 4
# 1 "/usr/include/linux/errno.h" 2 3 4
# 25 "/usr/include/bits/errno.h" 2 3 4
# 50 "/usr/include/bits/errno.h" 3 4

# 50 "/usr/include/bits/errno.h" 3 4
extern int *__errno_location (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
# 36 "/usr/include/errno.h" 2 3 4
# 58 "/usr/include/errno.h" 3 4

# 1 "test.c" 2

...haha...helpful... :/ Oh, wait, actually, that was helpful, but I could have just read errno.h the first time.
Code:
# 1 "/usr/include/linux/errno.h" 2 3 4

Yeah, that sounds like the right file.
Code:
#include <asm/errno.h>
...ok
Code:
#include <asm-generic/errno.h>
...->
Code:
#ifndef _ASM_GENERIC_ERRNO_H
#define _ASM_GENERIC_ERRNO_H

#include <asm-generic/errno-base.h>

#define	EDEADLK		35	/* Resource deadlock would occur */
#define	ENAMETOOLONG	36	/* File name too long */
#define	ENOLCK		37	/* No record locks available */

/*
 * This error code is special: arch syscall entry code will return
 * -ENOSYS if users try to call a syscall that doesn't exist.  To keep
 * failures of syscalls that really do exist distinguishable from
 * failures due to attempts to use a nonexistent syscall, syscall
 * implementations should refrain from returning -ENOSYS.
 */
#define	ENOSYS		38	/* Invalid system call number */

#define	ENOTEMPTY	39	/* Directory not empty */
#define	ELOOP		40	/* Too many symbolic links encountered */
#define	EWOULDBLOCK	EAGAIN	/* Operation would block */
#define	ENOMSG		42	/* No message of desired type */
#define	EIDRM		43	/* Identifier removed */
#define	ECHRNG		44	/* Channel number out of range */
#define	EL2NSYNC	45	/* Level 2 not synchronized */
#define	EL3HLT		46	/* Level 3 halted */
#define	EL3RST		47	/* Level 3 reset */
#define	ELNRNG		48	/* Link number out of range */
#define	EUNATCH		49	/* Protocol driver not attached */
#define	ENOCSI		50	/* No CSI structure available */
#define	EL2HLT		51	/* Level 2 halted */
#define	EBADE		52	/* Invalid exchange */
#define	EBADR		53	/* Invalid request descriptor */
#define	EXFULL		54	/* Exchange full */
#define	ENOANO		55	/* No anode */
#define	EBADRQC		56	/* Invalid request code */
#define	EBADSLT		57	/* Invalid slot */

#define	EDEADLOCK	EDEADLK

#define	EBFONT		59	/* Bad font file format */
#define	ENOSTR		60	/* Device not a stream */
#define	ENODATA		61	/* No data available */
#define	ETIME		62	/* Timer expired */
#define	ENOSR		63	/* Out of streams resources */
#define	ENONET		64	/* Machine is not on the network */
#define	ENOPKG		65	/* Package not installed */
#define	EREMOTE		66	/* Object is remote */
#define	ENOLINK		67	/* Link has been severed */
#define	EADV		68	/* Advertise error */
#define	ESRMNT		69	/* Srmount error */
#define	ECOMM		70	/* Communication error on send */
#define	EPROTO		71	/* Protocol error */
#define	EMULTIHOP	72	/* Multihop attempted */
#define	EDOTDOT		73	/* RFS specific error */
#define	EBADMSG		74	/* Not a data message */
#define	EOVERFLOW	75	/* Value too large for defined data type */
#define	ENOTUNIQ	76	/* Name not unique on network */
#define	EBADFD		77	/* File descriptor in bad state */
#define	EREMCHG		78	/* Remote address changed */
#define	ELIBACC		79	/* Can not access a needed shared library */
#define	ELIBBAD		80	/* Accessing a corrupted shared library */
#define	ELIBSCN		81	/* .lib section in a.out corrupted */
#define	ELIBMAX		82	/* Attempting to link in too many shared libraries */
#define	ELIBEXEC	83	/* Cannot exec a shared library directly */
#define	EILSEQ		84	/* Illegal byte sequence */
#define	ERESTART	85	/* Interrupted system call should be restarted */
#define	ESTRPIPE	86	/* Streams pipe error */
#define	EUSERS		87	/* Too many users */
#define	ENOTSOCK	88	/* Socket operation on non-socket */
#define	EDESTADDRREQ	89	/* Destination address required */
#define	EMSGSIZE	90	/* Message too long */
#define	EPROTOTYPE	91	/* Protocol wrong type for socket */
#define	ENOPROTOOPT	92	/* Protocol not available */
#define	EPROTONOSUPPORT	93	/* Protocol not supported */
#define	ESOCKTNOSUPPORT	94	/* Socket type not supported */
#define	EOPNOTSUPP	95	/* Operation not supported on transport endpoint */
#define	EPFNOSUPPORT	96	/* Protocol family not supported */
#define	EAFNOSUPPORT	97	/* Address family not supported by protocol */
#define	EADDRINUSE	98	/* Address already in use */
#define	EADDRNOTAVAIL	99	/* Cannot assign requested address */
#define	ENETDOWN	100	/* Network is down */
#define	ENETUNREACH	101	/* Network is unreachable */
#define	ENETRESET	102	/* Network dropped connection because of reset */
#define	ECONNABORTED	103	/* Software caused connection abort */
#define	ECONNRESET	104	/* Connection reset by peer */
#define	ENOBUFS		105	/* No buffer space available */
#define	EISCONN		106	/* Transport endpoint is already connected */
#define	ENOTCONN	107	/* Transport endpoint is not connected */
#define	ESHUTDOWN	108	/* Cannot send after transport endpoint shutdown */
#define	ETOOMANYREFS	109	/* Too many references: cannot splice */
#define	ETIMEDOUT	110	/* Connection timed out */
#define	ECONNREFUSED	111	/* Connection refused */
#define	EHOSTDOWN	112	/* Host is down */
#define	EHOSTUNREACH	113	/* No route to host */
#define	EALREADY	114	/* Operation already in progress */
#define	EINPROGRESS	115	/* Operation now in progress */
#define	ESTALE		116	/* Stale file handle */
#define	EUCLEAN		117	/* Structure needs cleaning */
#define	ENOTNAM		118	/* Not a XENIX named type file */
#define	ENAVAIL		119	/* No XENIX semaphores available */
#define	EISNAM		120	/* Is a named type file */
#define	EREMOTEIO	121	/* Remote I/O error */
#define	EDQUOT		122	/* Quota exceeded */

#define	ENOMEDIUM	123	/* No medium found */
#define	EMEDIUMTYPE	124	/* Wrong medium type */
#define	ECANCELED	125	/* Operation Canceled */
#define	ENOKEY		126	/* Required key not available */
#define	EKEYEXPIRED	127	/* Key has expired */
#define	EKEYREVOKED	128	/* Key has been revoked */
#define	EKEYREJECTED	129	/* Key was rejected by service */

/* for robust mutexes */
#define	EOWNERDEAD	130	/* Owner died */
#define	ENOTRECOVERABLE	131	/* State not recoverable */

#define ERFKILL		132	/* Operation not possible due to RF-kill */

#define EHWPOISON	133	/* Memory page has hardware error */

#endif

Bingo, my friends. But where's ENOENT? And other errnos I actually use? I see errno-base.h is also referenced...

Code:
#ifndef _ASM_GENERIC_ERRNO_BASE_H
#define _ASM_GENERIC_ERRNO_BASE_H

#define	EPERM		 1	/* Operation not permitted */
#define	ENOENT		 2	/* No such file or directory */
#define	ESRCH		 3	/* No such process */
#define	EINTR		 4	/* Interrupted system call */
#define	EIO		 5	/* I/O error */
#define	ENXIO		 6	/* No such device or address */
#define	E2BIG		 7	/* Argument list too long */
#define	ENOEXEC		 8	/* Exec format error */
#define	EBADF		 9	/* Bad file number */
#define	ECHILD		10	/* No child processes */
#define	EAGAIN		11	/* Try again */
#define	ENOMEM		12	/* Out of memory */
#define	EACCES		13	/* Permission denied */
#define	EFAULT		14	/* Bad address */
#define	ENOTBLK		15	/* Block device required */
#define	EBUSY		16	/* Device or resource busy */
#define	EEXIST		17	/* File exists */
#define	EXDEV		18	/* Cross-device link */
#define	ENODEV		19	/* No such device */
#define	ENOTDIR		20	/* Not a directory */
#define	EISDIR		21	/* Is a directory */
#define	EINVAL		22	/* Invalid argument */
#define	ENFILE		23	/* File table overflow */
#define	EMFILE		24	/* Too many open files */
#define	ENOTTY		25	/* Not a typewriter */
#define	ETXTBSY		26	/* Text file busy */
#define	EFBIG		27	/* File too large */
#define	ENOSPC		28	/* No space left on device */
#define	ESPIPE		29	/* Illegal seek */
#define	EROFS		30	/* Read-only file system */
#define	EMLINK		31	/* Too many links */
#define	EPIPE		32	/* Broken pipe */
#define	EDOM		33	/* Math argument out of domain of func */
#define	ERANGE		34	/* Math result not representable */

#endif
Haha. Found you. :)

This has been another episode of "why didn't you just read Advanced Programming in a UNIX Environment, 3rd Edition?"
Because it's $40 and I could have just done "man errno" instead of trying to read source code. God forbid I actually read the source code to learn about the libraries I'm using. *DRAMATIC EYEROLL*.
If you made it this far through this post then you must really think I'm amateurish, but that's actually the point. I am an amateur and this is mildly challenging. Multiply this times a lifetime of work and you realize how much unnecessary drama is involved in comprehending C++ libraries. The inspiration for this post was trying to figure out std::chrono and discovering name mangling in my std.
 
Top Bottom