how to check out wordsize on linux [closed] - c

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
As we can see a macro defined in stdint.h or bits/types.h etc.. which is __WORDSIZE. I don't know where to check out whether this macro is defined. Also, is there a way to checkout different size of the basic types without using the sizeof in c. I mean, is there a document exhibits the size of those variables?

Well, it depends on the platform. First, there are some requirements set by the C standard and/or the POSIX standard if you use UNIX. Things like sizeof(int) <= sizeof(long) or sizeof(char) == 1
Then the ABI has the final say. For example, on linux/freebsd/solaris on x86_64, they use a common ABI: http://people.freebsd.org/~obrien/amd64-elf-abi.pdf
3.1.2 in this document has the size for all types for this ABI

Related

Substitution of one type by another [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
When we perform substitution, can one type substitute another type?
This is too broad a question because it concerns general concepts of programming rather than specific programming language.
Thank You.
Substitution of one type for another is purely dependent on your requirement.
You can also typedef the given type or you can make your own type.
You can perform type substitution using template also
Btw your question is little incomplete to give accurate answer , what exactly you want to ask?

Get Size Of File From Commandline Input In C [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'm trying to get the size of a file from the commandline in C using argv. I'm not too familiar with file i/o in C, so any pointers would be greatly appreciated. Thanks.
You've not stated the platform, but your C program is given an argument list when it is started, and the file names are strings. The POSIX function you'd probably use is stat(); it takes a pointer to a struct stat and will put the file's size into the st_size member of the structure.
The answer may be different on Windows; the POSIX subsystem will provide a stat() workalike (probably named _stat()), but there'll also be a native interface.

sending variables to procedures in c and pascal [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
for sending variables to procedures what we should do in c and(or) pascal?
as i searched this work has to be done by BP( base pointer)
or rather i should say that BP do it,and one more thing is that C and Pascal are opposite of each other.
You question is entirely unclear. It would appear that you might be asking about C and Pascal calling conventions on the x86 architecture (at least your mention of BP hints at this).
If that's the case, I'd recommend you study the Wikipedia page on x86 calling conventions, and come back when you have specific questions.
edit You might also want to check out X86 Assembly/High-Level Languages along with the "Further Reading" links therein.

c programming query regarding sizeof operator Please specifythe output with reason in windows and linux [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
void main()
{
char c='0';
printf("%d %d",sizeof(c),sizeof('0'));
}
In C, size of char literal is equal to sizeof(int). So sizeof('0') gives the value of sizeof(int) on your implementation.
Also sizeof(char) is always 1 as mandated by the Standard.
The output will be 1 4. The type of the '0' literal is int, which on most systems has a size of 4. The C standard requires that sizeof(char) is 1.
If you get anything less than 4, get in your time machine, and dial in +25 years.

Max size of char* [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
Using C, how do we find the max size of char* allowed by a file system?
My assumption here is that you are asking for "What is the maximum allowable length of a file name allowed by a file system?"
This is dependent on the OS and how the filesystem is implemented, but most systems have defined macros that can be referenced.
In Linux, limits.h, the value can be reference by the macro PATH_MAX, 4096 (Current as of kernel 2.6.35)
In Windows, WinDef.h, the value can be reference by the macro MAX_PATH, 260 (Current as of Windows 7). This does not include the use of UNC paths (See comment below).

Resources