c

Is it valid to ignore an return value of an method in objective-c?

For example, when I call a method that returns an value, but I'm not interested in this at all, can I safely ignore that? Example, instead of: CGSize size = [str sizeWithFont:myFont minFontSize:19.0f actualFontSize:&actualFontSize forWidth:150.0f lineBreakMode:UILineBreakModeClip]; ...do this: [str sizeWithFont:myFont minFontSize:19...

Undefined, unspecified and implementation-defined behavior

What is the difference between these three? ...

Audio playback, creating nested loop for fade in/out.

Hi Folks, First time poster here. A quick question about setting up a loop here. I want to set up a for loop for the first 1/3 of the main loop that will increase a value from .00001 or similar to 1. So I can use it to multiply a sample variable so as to create a fade-in in this simple audio file playback routine. So far it's turning...

Inline functions with internal linkage?

In C: Why is so that only inline functions with internal linkage (ie declared with static) may reference (ie copy address, read, write, or call) a variable or function at file scope with static storage duration while other inline functions may not? ...

[C] - Invalid lvalue in assignment error when trying to make a pointer NULL

I have a pointer of a structure type that I made. On program start it begins as NULL and I then malloc/realloc as I need to add/remove these structures and I was just gonna use my pointer to point at the first structure and move through it like an array. When I malloc/realloc I always make the size of the "array"/area in memory one larg...

What does it mean when numbers end with U

As in this code: int nx = (int)((rev3[gx]) / 193U); Whats with the U in the end of 193 ? ...

Is "long" still useful in C?

It's not the largest integer type anymore now that there's "long long". It's not a fixed-width type: It's 32 bits on some platforms and 64 on others. It's not necessarily the same size as a pointer (for example, on 64-bit Windows) So, does "long" have any meaning anymore? Is there ever a reason to declare a long instead of a ptrdiff_...

Multidimensional array with unequal second dimension size using malloc()

Hello, I am playing around with multidimensional array of unequal second dimension size. Lets assume that I need the following data structure: [&ptr0]->[0][1][2][3][4][5][6][7][8][9] [&ptr1]->[0][1][2] [&ptr2]->[0][1][2][3][4] int main() { int *a[3]; int *b; int i; a[0] = (int *)malloc(10 * sizeof(int)); a[1] = (int *)malloc(2...

How is conversion of float/double to int handled in printf?

Consider this program int main() { float f = 11.22; double d = 44.55; int i,j; i = f; //cast float to int j = d; //cast double to int printf("i = %d, j = %d, f = %d, d = %d", i,j,f,d); //This prints the following: // i = 11, j = 44, f = -536870912, d = 107...

Reserve RAM in C

Hi I need ideas on how to write a C program that reserve a specified amount of MB RAM until a key [ex. the any key] is pressed on a Linux 2.6 32 bit system. * /.eat_ram.out 200 # If free -m is execute at this time, it should report 200 MB more in the used section, than before running the program. [Any key is pressed] # Now all the r...

GLib Hash Table - Pointer

I'm trying to increment the value of some specific key if it was found. For some reason I keep getting the (pointer) address when I dump all keys:values from the hash table. Output a: 153654132 // should be 5 b: 1 c: 153654276 // should be 3 d: 1 e: 1 f: 153654420 // should be 3 int proc() { ...

Additional macro support in clang?

Since LLVM/cLang is especially well designed. This seems like a great opportunity to augment the C/C++ macro/preprocessor system. Does anyone know of additional macro/preprocessor abilities added by Clang or side projects to make the macro system more powerful (like turing complete) Thakns! Note: I am asking about macros. Not C++ ...

On wxWidgets Mac version (wxMac) where is the setup.h file I need to modify?

I can't seem to find the right version of setup.h that gets used when building with ../configure, make. What directory is it? There seems to be tons of variations but I change them and the changes aren't used. Help. ...

calling c++ code from c

Hi all, is there any way where I can call c++ code from a c code class a { someFunction(); }; how to call someFunction() from a c code. in other way I am asking how to avoid name mangling here regards Vinayaka Karjigi ...

Is it a good idea for me to learn Python before C or some other Compiler language?

Right now I am going through MIT's introduction to Computer Science course via OpenCourseWare. As a part of this course I am learning the Python Language. I've read a lot of things about the benefits of learning C. Before I dig any deeper into Python I wonder if I will be hindered or helped by learning Python first. Do you think that I...

Counting Alphabetic Characters That Are Contained in an Array with C

Hello everyone, I am having trouble with a homework question that I've been working at for quite some time. I don't know exactly why the question is asking and need some clarification on that and also a push in the right direction. Here is the question: (2) Solve this problem using one single subscripted array of counters. The pro...

What does DetourAttach(&(PVOID &)BindKeyT, BindKeyD); mean? Attaching a detour to a memory address...

Hello everyone! This is just a simple question. I've been reading the source of something which attaches to a memory address of a subroutine using DetourAttach(&(PVOID &)BindKeyT, BindKeyD); where BindKeyT is the address to a subroutine in memory. I'm curious, what exactly does (&(PVOID &) mean in english? I understand that PVOID is a v...

Quick question regarding this issue, Why doesnt it print out the second value(converted second value) on the string?

Quick question, What have I done wrong here. The purpose of this code is to get the input into a string, the input being "12 34", with a space in between the "12" and "32" and to convert and print the two separate numbers from an integer variable known as number. Why doesn't the second call to the function copyTemp, not produce the value...

Implementing traceback on i386

Hi, I am currently porting our code from an alpha (Tru64) to an i386 processor (Linux) in C. Everything has gone pretty smoothly up until I looked into porting our exception handling routine. Currently we have a parent process which spawns lots of sub processes, and when one of these sub-processes fatal's (unfielded) I have routines to ...

help understanding differences between #define, const and enum in C and C++ on assembly level.

recently, i am looking into assembly codes for #define, const and enum: C codes(#define): 3 #define pi 3 4 int main(void) 5 { 6 int a,r=1; 7 a=2*pi*r; 8 return 0; 9 } assembly codes(for line 6 and 7 in c codes) generated by GCC: 6 mov $0x1, -0x4(%ebp) 7 mov -0x4(%ebp), %edx 7 mov %edx, %ea...