Anonymous
except maybe some embedded applications
Anonymous
I began with c and the steep learning curve bored me. Switched to py then later came back to c
Anonymous
OH WAIT
Anonymous
there are some things
Anonymous
you can do in C but not in C++
Shivam
Anonymous
but they are considered bugs by C++ programmers
Shivam
Anonymous
Hi
Anonymous
C99 has variable length arrays
Anonymous
which C++ says is stupid
Anonymous
and disallows
olli
using VLAs might not be the best choice ...
Anonymous
if i recall C++ likes to complain when i try calling a function pointer with a different prototype then the function i am calling
Anonymous
however this is perfectly ok in C
Anonymous
offsets into the middle of the function are much harder to calculate in C++
Anonymous
https://en.m.wikipedia.org/wiki/Restrict
Anonymous
this is not in C++
Anonymous
BinaryByter
BinaryByter
but not as well as in C++
Anonymous
Anonymous
then swap the prototype to a new function prototype to handle execution from that point
Anonymous
then run it
olli
Anonymous
i have some C code
Anonymous
that shows how to do this
Anonymous
but it has to be compiled under O0
Anonymous
using gcc
Anonymous
,
olli
Yes because it's UB
Anonymous
C++ prevents gotos from crossing initialization
Anonymous
Anonymous
this is defined behaviour
olli
how?
Anonymous
for a specific compiler
Anonymous
you know that the compiler will generate certain machine code for different lines of code
Anonymous
given a 0 optimization level
Anonymous
you calculate the machine code bytes needed in order to get to the section you want to execute
olli
I though we were talking about C not a compiler?
Anonymous
this if anything is IB
Anonymous
implementation defined behaviour
olli
Well, actually every UB is probably somehow IB since the vendors are free to do it how they want it
BinaryByter
/unban @girlfriendmenno
BinaryByter
/unban @girlfriendmenno
Mihail
BinaryByter
wat?
Shivam
Lol
Ariana
Mihail
re send the command
BinaryByter
#ot
Shivam
Off topic?
Anonymous
In C, a function prototype without parameters, e.g. int foo();, implies that the parameters are unspecified. Therefore, it is legal to call such a function with one or more arguments, e.g. foo(42, "hello world"). In contrast, in C++ a function prototype without arguments means that the function takes no arguments, and calling such a function with arguments is ill-formed. In C, the correct way to declare a function that takes no arguments is by using 'void', as in int foo(void);, which is also valid in C++. Empty function prototypes are a deprecated feature in C99 (as they were in C89).
this is what i was talking about
olli
In C, a function prototype without parameters, e.g. int foo();, implies that the parameters are unspecified. Therefore, it is legal to call such a function with one or more arguments, e.g. foo(42, "hello world"). In contrast, in C++ a function prototype without arguments means that the function takes no arguments, and calling such a function with arguments is ill-formed. In C, the correct way to declare a function that takes no arguments is by using 'void', as in int foo(void);, which is also valid in C++. Empty function prototypes are a deprecated feature in C99 (as they were in C89).
this is what i was talking about
yes, this is true.
But the same applies to function definitions and declarations as well
Anonymous
would make the function ()
Anonymous
then i would call the function as is without any issues
Anonymous
then i would call the function again but this time giving a offset and passing a bunch of parameters
Anonymous
into the function pointer definition
Dexter
Dexter
I want to make this upside down
I tried but messed up....
BinaryByter
Dexter
BinaryByter
Prometheus
That's probably the way that has the least chance of crashing your system are least.
Prometheus
Ariana
you can add numbers to characters
Ariana
A+1=B
Ariana
B+1=C...
Mihail
what's the point of the ascii function?
Dexter
Wait a min please
I believe in trying several times before wasting others time...
Last time i encountered an error that was due to environment...
I want to be sure this time...
Mihail
Mihail
your function does literally that, but worse in every way
Mihail
yes using functions is obviously a good idea, but just making up functions isn't
Mihail
to do things like setting a number
Dexter
My fingers are actually making out with the keyboard I'll let you know in a min
But if i failed again
I need your help guys