« first day (1205 days earlier)      last day (2651 days later) » 

01:24
@nohup That is a good question, but unfortunately it is something that is implementation defined. The standard only says, that:
> The realloc function deallocates the old object pointed to by ptr and returns a pointer to a new object that has the size specified by size. The contents of the new object shall be the same as that of the old object prior to deallocation, up to the lesser of the new and old sizes. Any bytes in the new object beyond the size of the old object have indeterminate values.
C11 Standard 7.22.3.5p2 (page 349)
We can do educated guesses, like most of the sane implementations will probably do nothing with the given memory block, and will return the same pointer that you gave to realloc and internally it will "shrink" the allocated size of the block, that is, it will freely write to the remaining blocks of the old allocation -- however since the standard does not specify such behaviour, it will be a foolish thing to build on such thoughts
Anonymous
I like the description of the room.
helloc @FrancescoMenzani;
I'm glad you do :)
01:42
If I might ask,
the C standard has an API, such as fscanf, vfscanf, but where those naming came from? for example, how do I know what setvbuf stands for? There must be some document which explain why these function naming choosen, but unfortunately I can't find it anywhere in the Internet. Would you like to help me?
helloc @Unknown123;
helloc @PeterVaro;
nice new feature btw
I cannot redirect you to any exact documentations on this -- I could only search for you, which is something that you can do as well -- however, I can tell you that the shortening/abbreviations have a good reason, and that reason can be find in the C90 standard: the externally available identifier names should have been maximum 6 characters long
(give me a sec to find this in the actual standard, unfortunately I don't use this old standard anymore, so it might take a while, bare with me :) )
@Unknown123 which feature?
longjmp(helloc, @PeterVaro);
> The implementation shall treat at least the first 31 characters of an internal name (a macro name or an identifier that does not have external linkage) as significant. Corresponding lower-case and upper-case letters are different. The implementation may further restrict the significance of an external name (an identifier that has external linkage) to six characters and may ignore distinctions of alphabetical case for such names. These limitations on identifiers are all implementation-defined.
01:50
thank you for kindness, I really appreciate it, yes it must have I agree with you, but some of the naming convention is not easy to extract such as setvbuf, I think that v is variadic, but I could be wrong, this is the C11 Latest Working Draft Standard port70.net/~nsz/c/c11/n1570.pdf Nowhere does it mentions why setvbuf was chosed
C90 3.1.2 Implementation Limits
@Unknown123 You will not find historical explanations on naming conventions in the standard (I usually use the PDF version of the current standard: C11 Standard)
also, let me warn you, that it may look like a consistent naming convention that the standard is using, I can assure you it is not :/
and I can only encourage you to come up with something better than this
helloc @Byte; // how things are, mate?
psignal(@PeterVaro, "I'm okay.");
// Might be using the signal function wrong. Will wait to see if system@PeterVaro complains.
so do you think setvbuf stands for set variable buffer then? really back then when I first learn C, I don't know the essence what does fgets is, sscanf is what printf is, I just only know it used for input or output, and I often easily forget it. Since i know the abbreviation, it makes me easier to remind what is this function doing, everything is beautifully mapped in my brain.
What is your advice then? Should I keep trial and error finding the abbreviation of all the standards API or even POSIX stands for?
02:07
@Unknown123 I don't think memorizing the abbreviations would help you. I usually look at the manual pages for explanations of functionality and use my own mnemonics to remember.
@PeterVaro Btw I just read the "Missed C Compiler Optimisations" you starred. I think I disagree with the first point about the "useless initialization of struct passed by value".
@Unknown123 I have no idea what the 'v' stands for in setvbuf, I can only guess. My guess is, that it stands for variable as in something that can be varied, and my guess is based on the definition of the setbuf function in the standard:
> Except that it returns no value, the setbuf function is equivalent to the setvbuf function invoked with the values _IOFBF for mode and BUFSIZ for size, or (if buf is a null pointer), with the value _IONBF for mode
When passing the struct by value, the compiler respects the programmer's choice to copy the struct, even though it immediately returns the first field. It expects the programmer to be smart and pass a pointer if he/she wants to optimize like that.
C11 Standard 7.21.5.5p2 (page 307)
@Byte I did not starred it, I just linked it here as a thought-provoking post
:P
Ohhhh
*star (-ed)
anyway, it's time for me to call it a night
free all;
02:20
@PeterVaro While you're here. I have a quick question. When doing man grep
Oh okay
I got it, nvm :D
02:34
What a beautiful discussion that we have haha, I still have a hope that there is a rationale or something, thank you so much for the advice I'll remember it
free @PeterVaro @Byte;
 
4 hours later…
06:17
@PeterVaro Thank you Peter for the kind reply.

« first day (1205 days earlier)      last day (2651 days later) »