Daniele
we need a note for that
V01D
Lol
V01D
Damn
Daniele
oh so there is a "note"
V01D
Press F to pay respects, lol.
Daniele
F
Zel
F
Zel
So back to the array issue if you need something you can dynamically size look at std::vector.
V01D
Welcome
Brown
Any website for C manual ? Definition and catogarised libraries.
Zel
Ah, then yeah.
Ahmet Kandemir
Hello, is there anyone among us who used the book Cryptography in C and C ++ by Michael Welschenbach? I started getting interested in the field of cryptotechnology, I am asking because of that.
J
#include<stdio.h> void main( ){ Int size = 5 ; Int array1[size] = {1,3,5,6,7}; } Run or not
if you're statically initializing anything, skip the size spec altogether. this will allow you to 1) change only the static initialization list, if necessary and 2) avoid needlessly keeping track of a separate, static, variable, for that size
J
because 2.1) you can determine that size both during compile-time (sizeof()) and runtime
J
i suggest you grab this instead then: https://www.amazon.de/-/en/Jean-Philippe-Aumasson/dp/1593278268/
Ahmet Kandemir
i suggest you grab this instead then: https://www.amazon.de/-/en/Jean-Philippe-Aumasson/dp/1593278268/
Could you also say your reason for suggestion? I mean that the one you suggested is more friendly for newbies or it starts from very basics?
J
yeah, so, that'll introduce you (briefly) to the history and evolution of the field, explain and introduce you to the concept of 'security' in computing and transmission, introduce you to fundamental concepts of cryptography like algorithm design, algorithm evaluation, attacker models and a bunch more
J
Could you also say your reason for suggestion? I mean that the one you suggested is more friendly for newbies or it starts from very basics?
This practical guide to modern encryption breaks down the fundamental mathematical concepts at the heart of cryptography without shying away from meaty discussions of how they work. You’ll learn about authenticated encryption, secure randomness, hash functions, block ciphers, and public-key techniques such as RSA and elliptic curve cryptography. You’ll also learn: - Key concepts in cryptography, such as computational security, attacker models, and forward secrecy - The strengths and limitations of the TLS protocol behind HTTPS secure websites - Quantum computation and post-quantum cryptography - About various vulnerabilities by examining numerous code examples and use cases - How to choose the best algorithm or protocol and ask vendors the right questions Each chapter includes a discussion of common implementation mistakes using real-world examples and details what could go wrong and how to avoid these pitfalls. Whether you’re a seasoned practitioner or a beginner looking to dive into the field, Serious Cryptography will provide a complete survey of modern encryption and its applications.
J
that's what the amazon description says, and yes, it does fall to that description, but i found it great at establishing the topic subjects and introduction
J
i have a paperback copy of it on my shelf. its a nice read on a sunny weekend afternoon
V01D
Ooh, I might get myself a copy..
Ahmet Kandemir
Thanks a lot for detailed explanation. I really appreciated for that
Zel
type name[size]={intailizers} example: int array[5]={1,2,3,4,5} or array[5]={0,1,2,3,4} Do not do the following: int array[5]={1,2,3,4,.5,6} going out of bounds may or may nor produce a compile error, but it -will- produce a insta-terminate of your program once you try to access the out of bound element.
Zel
If you really want a strict compiler use -pedantic anything at all the compiler detects against ISO will become an error.
Zel
Which reminds me now that I'm done prototyping my resource management system I need to turn that back on.
Ahmet Kandemir
He copy and pasted the book description ;)
Hmm, but he don’t have to do that :P
V01D
Missing array type
Zel
yeah
Zel
It does work, just the int a = 5 is not nessicary, just use 5 in the [] save memory and save your self headaches later.
V01D
int a = 5 should be const int a = 5
V01D
Other wise you could resize the array accidentally which is illegal in C
V01D
std::vector can resize arrays (I think)
Zel
That too, but that whole line is really not needed. :/
V01D
But ONLY in that case
V01D
That too, but that whole line is really not needed. :/
No literally that - It will not compile unless you add a const keyword.
Zel
std::vector<int> a; a.resize(5);
V01D
Cool
Zel
No literally that - It will not compile unless you add a const keyword.
Wait yeah, I forgot about that not comipling in pure C.
Zel
Oh side note while making multi dimensional arrays works fine, do not use multidimensional vectors, too easy to setup undefined behaivor.
V01D
Idk about that, learning C++ rn
Zel
I just got through debugging a friend's code, and every single one of his multi dimensional vectors forced sig trap in GDB.
V01D
Damn
V01D
Big rip
Zel
I recoded each one as a multi dimensional array of a fixed set of dimensions, purred like a kitten with a 0x0 exit status.
Zel
may be a compiler extension that allows that hence the need to use -pedantic
Zel
gcc in particular is famous for having non standard extensions for convenience, although MSVC/++ isn't much better.
Zel
There ya go, you may want to avoid those, I'm still learning some things but extensions made me want to rip my hair out when people kept saying that my examples were invalid when I was asking newbish questions.
V01D
-nostdlib xD
Zel
If you code outside standard it will possibly cuase other compilers to fail. You also prolly should tell it to use only standards as it will force you to learn the sandards
Zel
also nostdlib will cause it not to import the template library.
Zel
He may not though.
V01D
Hence the xD. I use -nostdlib in my kernel
V01D
He may not though.
It is self explanatory enough
Zel
Just doing a little research on the multidimensional vector thing, seems that if you set up a vector within a vector it's limited to the overall size of the first vector. So multidimensional vectors are technically pointless.
Emir
++i = 10; unlike C, why is this L-value expression in C++?
Zel
so if x =0 an i =1, if you then set x= ++i x now =2 and i now = 2 if you set x = i++ x now =2 and i=1
Zel
Now in the case of the statement ++i; or i++; there is no difference.
V01D
Zel
it only effects it if you are using it in the same statement with an operator such as =, ==, < , > , <=, >=,
Zel
in solo they both just increnet the varbile
V01D
Only matters in loops
Zel
so the statement ++i; and i++; again with out an operator are the same. XD
V01D
:)
Zel
either way it's just a short cut for either +1 or +1 and store value.
Vlad
so the statement ++i; and i++; again with out an operator are the same. XD
If the copy isn't used compiler will optimize i++ to be ++i
V01D
Interesting
Zel
Makes sense really since with out an operator the default behavior is +=1.
V01D
I should learn more about how gcc works...
Zel
Or in some cases doesn't read some of Linus Torvalds comments on that topic.