Search Results

Search found 2566 results on 103 pages for 'struct'.

Page 15/103 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • how to write binary copy of structure array to file

    - by cerr
    I would like to write a binary image of a structure array to a binary file. I have tried this so far: #include <stdio.h> #include <string.h> #define NUM 256 const char *fname="binary.bin"; typedef struct foo_s { int intA; int intB; char string[20]; }foo_t; void main (void) { foo_t bar[NUM]; bar[0].intA = 10; bar[0].intB = 999; strcpy(bar[0].string,"Hello World!"); Save(bar); printf("%s written succesfully!\n",fname); } int Save(foo_t* pData) { FILE *pFile; int ptr = 0; int itr = 0; pFile = fopen(fname, "w"); if (pFile == NULL) { printf("couldn't open %s\n", fname); return; } for (itr = 0; itr<NUM; itr++) { for (ptr=0; ptr<sizeof(foo_t); ptr++) { fputc((unsigned char)*((&pData[itr])+ptr), pFile); } fclose(pFile); } } but the compiler is saying aggregate value used where an integer was expected fputc((unsigned char)*((&pData[itr])+ptr), pFile); and I don't quite understand why, what am I doing wrong? Thanks!

    Read the article

  • safe structures embedded systems

    - by user405633
    I have a packet from a server which is parsed in an embedded system. I need to parse it in a very efficient way, avoiding memory issues, like overlapping, corrupting my memory and others variables. The packet has this structure "String A:String B:String C". As example, here the packet received is compounded of three parts separated using a separator ":", all these parts must be accesibles from an structure. Which is the most efficient and safe way to do this. A.- Creating an structure with attributes (partA, PartB PartC) sized with a criteria based on avoid exceed this sized from the source of the packet, and attaching also an index with the length of each part in a way to avoid extracting garbage, this part length indicator could be less or equal to 300 (ie: part B). typedef struct parsedPacket_struct { char partA[2];int len_partA; char partB[300];int len_partB; char partC[2];int len_partC; }parsedPacket; The problem here is that I am wasting memory, because each structure should copy the packet content to each the structure, is there a way to only save the base address of each part and still using the len_partX.

    Read the article

  • const pod and std::vector

    - by Baz
    To get this code to compile: std::vector<Foo> factory() { std::vector<Foo> data; return data; } I have to define my POD like this: struct Foo { const int i; const int j; Foo(const int _i, const int _j): i(_i), j(_j) {} Foo(Foo& foo): i(foo.i), j(foo.j){} Foo operator=(Foo& foo) { Foo f(foo.i, foo.j); return f; } }; Is this the correct approach for defining a pod where I'm not interested in changing the pod members after creation? Why am I forced to define a copy constructor and overload the assignment operator? Is this compatible for different platform implementations of std::vector? Is it wrong in your opinion to have const PODS like this? Should I just leave them as non-const?

    Read the article

  • How to copy bytes from buffer into the managed struct?

    - by Chupo_cro
    I have a problem with getting the code to work in a managed environment (VS2008 C++/CLI Win Forms App). The problem is I cannot declare the unmanaged struct (is that even possible?) inside the managed code, so I've declared a managed struct but now I have a problem how to copy bytes from buffer into that struct. Here is the pure C++ code that obviously works as expected: typedef struct GPS_point { float point_unknown_1; float latitude; float longitude; float altitude; // x10000 float time; int point_unknown_2; int speed; // x100 int manually_logged_point; // flag (1 --> point logged manually) } track_point; int offset = 0; int filesize = 256; // simulates filesize int point_num = 10; // simulates number of records int main () { char *buffer_dyn = new char[filesize]; // allocate RAM // here, the file would have been read into the buffer buffer_dyn[0xa8] = 0x1e; // simulates the speed data (1e 00 00 00) buffer_dyn[0xa9] = 0x00; buffer_dyn[0xaa] = 0x00; buffer_dyn[0xab] = 0x00; offset = 0x90; // if the data with this offset is transfered trom buffer // to struct, int speed is alligned with the buffer at the // offset of 0xa8 track_point *points = new track_point[point_num]; points[0].speed = 0xff; // (debug) it should change into 0x1e memcpy(&points[0],buffer_dyn+offset,32); cout << "offset: " << offset << "\r\n"; //cout << "speed: " << points[0].speed << "\r\n"; printf ("speed : 0x%x\r\n",points[0].speed); printf("byte at offset 0xa8: 0x%x\r\n",(unsigned char)buffer_dyn[0xa8]); // should be 0x1e delete[] buffer_dyn; // release RAM delete[] points; /* What I need is to rewrite the lines 29 and 31 to work in the managed code (VS2008 Win Forms C++/CLI) What should I have after: array<track_point^>^ points = gcnew array<track_point^>(point_num); so I can copy 32 bytes from buffer_dyn to the managed struct declared as typedef ref struct GPS_point { float point_unknown_1; float latitude; float longitude; float altitude; // x10000 float time; int point_unknown_2; int speed; // x100 int manually_logged_point; // flag (1 --> point logged manually) } track_point; */ return 0; } Here is the paste to codepad.org so it can be seen the code is OK. What I need is to rewrite these two lines: track_point *points = new track_point[point_num]; memcpy(&points[0],buffer_dyn+offset,32); to something that will work in a managed application. I wrote: array<track_point^>^ points = gcnew array<track_point^>(point_num); and now trying to reproduce the described copying of the data from buffer over the struct, but haven't any idea how it should be done. Alternatively, if there is a way to use an unmanaged struct in the same way shown in my code, then I would like to avoid working with managed struct.

    Read the article

  • Need advice about pointers and time elapsed program. How to fix invalid operands and cannot convert errors?

    - by user1781382
    I am trying to write a program that tells the difference between the two times the user inputs. I am not sure how to go about this. I get the errors : Line 27|error: invalid operands of types 'int' and 'const MyTime*' to binary 'operator-'| Line |39|error: cannot convert 'MyTime' to 'const MyTime*' for argument '1' to 'int DetermineElapsedTime(const MyTime*, const MyTime*)'| I also need a lot of help in this problem. I don't have a good curriculum, and my class textbook is like cliffnotes for programming. This will be my last class at this university. The C++ teztbook I use(my own not for class) is Sam's C++ One hour a day. #include <iostream> #include<cstdlib> #include<cstring> using namespace std; struct MyTime { int hours, minutes, seconds; }; int DetermineElapsedTime(const MyTime *t1, const MyTime *t2); long t1, t2; int DetermineElapsedTime(const MyTime *t1, const MyTime *t2) { return((int)t2-t1); } int main(void) { char delim1, delim2; MyTime tm, tm2; cout << "Input two formats for the time. Separate each with a space. Ex: hr:min:sec\n"; cin >> tm.hours >> delim1 >> tm.minutes >> delim2 >> tm.seconds; cin >> tm2.hours >> delim1 >> tm2.minutes >> delim2 >> tm2.seconds; DetermineElapsedTime(tm, tm2); return 0; } I have to fix the errors first. Anyone have any ideas??

    Read the article

  • (C#) Label.Text = Struct.Value (Microsoft.VisualStudio.Debugger.Runtime.CrossThreadMessagingException)

    - by Kyle
    I have an app that I'm working on that polls usage from an ISP (Download quota). I've tried threading this via 'new Thread(ThreaProc)' but that didn't work, now trying an IAsyncResult based approach which does the same thing... I've got no idea on how to rectify, please help? The need-to-know: // Global public delegate void AsyncPollData(ref POLLDATA pData); // Class scope: private POLLDATA pData; private void UpdateUsage() { AsyncPollData PollDataProc = new AsyncPollData(frmMain.PollUsage); IAsyncResult result = PollDataProc.BeginInvoke(ref pData, new AsyncCallback(UpdateDone), PollDataProc); } public void UpdateDone(IAsyncResult ar) { AsyncPollData PollDataProc = (AsyncPollData)ar.AsyncState; PollDataProc.EndInvoke(ref pData, ar); // The Exception occurs here: lblStatus.Text = pData.LastError; } public static void PollUsage(ref POLLDATA PData) { PData.LastError = "Some string"; return; }

    Read the article

  • expected class,delegate,enum,interface or struct

    - by Luke
    Hello, I am writing a class. I have encountered the problem in the title. Here is the code: class delivery { private string strDeliveryName; private string strDeliveryAddress; private string strDeliveryDay; private string strDeliveryTime; private string strDeliveryMeal; private string strDeliveryInstructions; private string strDeliveryStatus; } public delivery(string deliveryName, string deliveryAddress, string deliveryDay, string deliveryTime, string deliveryMeal, string deliveryInstructions, string deliveryStatus) { strDeliveryName = deliveryName; strDeliveryAddress = deliveryAddress; strDeliveryDay = deliveryDay; strDeliveryTime = deliveryTime; strDeliveryMeal = deliveryMeal; strDeliveryInstructions = deliveryInstructions; strDeliveryStatus = deliveryStatus; } I get the error on the public delivery, any idea why?

    Read the article

  • adhoc struct/class in C#?

    - by acidzombie24
    Currently i am using reflection with sql. I find if i want to make a specialize query it is easiest to get the results by creating a new class inheriting from another and adding the 2 members/columns for my specialized query. Then due to reflections in the lib in my c# code i can write foreach(var v in list) { v.AnyMember and v.MyExtraMember) Now instead of having the class scattered around or modifying my main DB.cs file can i define a class inside a function? I know i can create an anonymous object by writing new {name=val, name2=...}; but i need a to pass this class in a generic function func(query, args);

    Read the article

  • struct and arguments

    - by jay
    I am trying to modularize a function that used to add values to multiple structures in one call. Now I want to do one value addition per call, but I am not sure how to make a less specific argument reference. func ( [?] *val ) { }

    Read the article

  • Insert a Coldfusion struct into a database

    - by Kevin
    If I wanted to save a contact form submission to the database, how can I insert the form scope in as the submission? It's been some time since I used Coldfusion. The contact forms vary depending on what part of the site it was submitted from, so it needs to scale and handle a form with 5 fields or one with 10 fields. I just want to store the data in a blob table.

    Read the article

  • debug error : max must have union class struct types

    - by hcemp
    this is my code: #include <iostream> using namespace std; class Sp { private : int a;int b; public: Sp(int x=0,int y=0):a(x),b(y){}; int max(int x,int y); }; int Sp::max(int a,int b) { return (a>b?a:b);}; int main() { int q,q1; cin>>q>>q1; Sp *mm=new Sp(q,q1); cout<< mm.max(q,q1); return 0; }

    Read the article

  • Java webservice does not return all struct array

    - by Aykut
    Hi I wrote a webservice which runs correctly. In the webservice, there is a class which contains other classes' arrays and the webservice returns this class's instance. for example public class cls1 implements Serializable{ cls2[] cls2Arr; cls3[] cls3Arr; } I fill this arrays (cls2Arr and cls3Arr) correctly in service side. When I read this arrays from client, I see only last item of arrays. I checked on the service side before the webservice returns, and the cls1 instance and everything else looked good. What can be a reason ? Thx

    Read the article

  • Looping over a Cfquery or a Struct ?

    - by Somu
    Hi I have a query which retrieves Some data. I want to display that data considering some conditions in different div tags. Now my question is, I am doing this by looping the query once and getting the data in three different structs and using these structs while displaying. Is this a good approach or looping through the query everytime in each div to check the condition is the rirht approach ? <tr > features: #getAttributes.seat# Disclosures: #getTicketAttributes.seat#

    Read the article

  • Defining golang struct function using pointer or not

    - by Jacob
    Can someone explain to me why appending to an array works when you do this: func (s *Sample) Append(name string) { d := &Stuff{ name: name, } s.data = append(s.data, d) } Full code here But not when you do this: func (s Sample) Append(name string) { d := &Stuff{ name: name, } s.data = append(s.data, d) } Is there any reason at all why you would want to use the second example.

    Read the article

  • C++ strcpy(Struct.Property, "VALUE") Use in C#?

    - by gtas
    Hi all, i created a Wrapper for a C++ dll. While reading the documentation i reached to a point using this function strcpy(StructName.strPropGetter, "A STRING"); I'm not kinda C++ guy, i can't figure how to transfer this code in C#. My wrapper gave me this property without a setter. Any light would be nice. Thank you

    Read the article

  • C struct print, decode this code?

    - by pauliwago
    I am in the process of studying for a test, and I'm trying to work through some practice problems. I've been working on this a while now..but can't figure it out. Please take a look at the code fragment: union { int i; short x; unsigned short u; float f; } testout; testout.i=0xC0208000; Before I ask the question, can someone please explain to me how the above code works?? My guess is that testout.i=0xC0208000 puts either an int, short, unsigned short, or float and puts the result in that address. (?) The question is what prints out if we write printf("%d", testout.x)? I know we should expect digits....but I have no idea where they are getting the digits from....there is no output. Any explanation would be greatly appreciated. Thanks!

    Read the article

  • Hi, I have a C hashing routine which is behaving strangely?

    - by aks
    Hi, In this hashing routine: 1.) I am able to add strings. 2.) I am able to view my added strings. 3.) When i try to add a duplicate string, it throws me an error saying already present. 4.) But, when i try to delete the same string which is already present in hash table, then the lookup_routine calls hash function to get an index. At this time, it throws a different hash index to the one it was already added. Hence, my delete routine is failing? I am able to understand the reason why for same string, hash fucntion calculates a different index each time (whereas the same logic works in view hash table routine)? Can someone help me? This is the Output, i am getting: $ ./a Press 1 to add an element to the hashtable Press 2 to delete an element from the hashtable Press 3 to search the hashtable Press 4 to view the hashtable Press 5 to exit Please enter your choice: 1 Please enter the string :gaura enters in add_string DEBUG purpose in hash function: str passed = gaura Hashval returned in hash func= 1 hashval = 1 enters in lookup_string str in lookup_string = gaura DEBUG purpose in hash function: str passed = gaura Hashval returned in hash func= 1 hashval = 1 DEBUG ERROR :element not found in lookup string DEBUG Purpose NULL Inserting... DEBUG1 : enters here hashval = 1 String added successfully Press 1 to add an element to the hashtable Press 2 to delete an element from the hashtable Press 3 to search the hashtable Press 4 to view the hashtable Press 5 to exit Please enter your choice: 1 Please enter the string :ayu enters in add_string DEBUG purpose in hash function: str passed = ayu Hashval returned in hash func= 1 hashval = 1 enters in lookup_string str in lookup_string = ayu DEBUG purpose in hash function: str passed = ayu Hashval returned in hash func= 1 hashval = 1 returns NULL in lookup_string DEBUG Purpose NULL Inserting... DEBUG2 : enters here hashval = 1 String added successfully Press 1 to add an element to the hashtable Press 2 to delete an element from the hashtable Press 3 to search the hashtable Press 4 to view the hashtable Press 5 to exit Please enter your choice: 1 Please enter the string :gaurava enters in add_string DEBUG purpose in hash function: str passed = gaurava Hashval returned in hash func= 7 hashval = 7 enters in lookup_string str in lookup_string = gaurava DEBUG purpose in hash function: str passed = gaurava Hashval returned in hash func= 7 hashval = 7 DEBUG ERROR :element not found in lookup string DEBUG Purpose NULL Inserting... DEBUG1 : enters here hashval = 7 String added successfully Press 1 to add an element to the hashtable Press 2 to delete an element from the hashtable Press 3 to search the hashtable Press 4 to view the hashtable Press 5 to exit Please enter your choice: 4 Index : i = 1 String = gaura ayu Index : i = 7 String = gaurava Press 1 to add an element to the hashtable Press 2 to delete an element from the hashtable Press 3 to search the hashtable Press 4 to view the hashtable Press 5 to exit Please enter your choice: 2 Please enter the string you want to delete :gaura String entered = gaura enters in delete_string DEBUG purpose in hash function: str passed = gaura Hashval returned in hash func= 0 hashval = 0 enters in lookup_string str in lookup_string = gaura DEBUG purpose in hash function: str passed = gaura Hashval returned in hash func= 0 hashval = 0 DEBUG ERROR :element not found in lookup string DEBUG Purpose Item not present. So, cannot be deleted Item found in list: Deletion failed Press 1 to add an element to the hashtable Press 2 to delete an element from the hashtable Press 3 to search the hashtable Press 4 to view the hashtable Press 5 to exit Please enter your choice: My routine is pasted below: include include struct list { char *string; struct list *next; }; struct hash_table { int size; /* the size of the table */ struct list *table; / the table elements */ }; struct hash_table * hashtable = NULL; struct hash_table *create_hash_table(int size) { struct hash_table *new_table; int i; if (size<1) return NULL; /* invalid size for table */ /* Attempt to allocate memory for the table structure */ if ((new_table = malloc(sizeof(struct hash_table))) == NULL) { return NULL; } /* Attempt to allocate memory for the table itself */ if ((new_table->table = malloc(sizeof(struct list *) * size)) == NULL) { return NULL; } /* Initialize the elements of the table */ for(i=0; i<size; i++) new_table->table[i] = '\0'; /* Set the table's size */ new_table->size = size; return new_table; } unsigned int hash(struct hash_table *hashtable, char *str) { printf("\n DEBUG purpose in hash function:\n"); printf("\n str passed = %s", str); unsigned int hashval = 0; int i = 0; for(; *str != '\0'; str++) { hashval += str[i]; i++; } hashval = hashval % 10; printf("\n Hashval returned in hash func= %d", hashval); return hashval; } struct list *lookup_string(struct hash_table *hashtable, char *str) { printf("\n enters in lookup_string \n"); printf("\n str in lookup_string = %s",str); struct list * new_list; unsigned int hashval = hash(hashtable, str); printf("\n hashval = %d \n", hashval); if(hashtable->table[hashval] == NULL) { printf("\n DEBUG ERROR :element not found in lookup string \n"); return NULL; } /* Go to the correct list based on the hash value and see if str is * in the list. If it is, return return a pointer to the list element. * If it isn't, the item isn't in the table, so return NULL. */ for(new_list = hashtable->table[hashval]; new_list != NULL;new_list = new_list->next) { if (strcmp(str, new_list->string) == 0) return new_list; } printf("\n returns NULL in lookup_string \n"); return NULL; } int add_string(struct hash_table *hashtable, char *str) { printf("\n enters in add_string \n"); struct list *new_list; struct list *current_list; unsigned int hashval = hash(hashtable, str); printf("\n hashval = %d", hashval); /* Attempt to allocate memory for list */ if ((new_list = malloc(sizeof(struct list))) == NULL) { printf("\n enters here \n"); return 1; } /* Does item already exist? */ current_list = lookup_string(hashtable, str); if (current_list == NULL) { printf("\n DEBUG Purpose \n"); printf("\n NULL \n"); } /* item already exists, don't insert it again. */ if (current_list != NULL) { printf("\n Item already present...\n"); return 2; } /* Insert into list */ printf("\n Inserting...\n"); new_list->string = strdup(str); new_list->next = NULL; //new_list->next = hashtable->table[hashval]; if(hashtable->table[hashval] == NULL) { printf("\n DEBUG1 : enters here \n"); printf("\n hashval = %d", hashval); hashtable->table[hashval] = new_list; } else { printf("\n DEBUG2 : enters here \n"); printf("\n hashval = %d", hashval); struct list * temp_list = hashtable->table[hashval]; while(temp_list->next!=NULL) temp_list = temp_list->next; temp_list->next = new_list; // hashtable->table[hashval] = new_list; } return 0; } int delete_string(struct hash_table *hashtable, char *str) { printf("\n enters in delete_string \n"); struct list *new_list; struct list *current_list; unsigned int hashval = hash(hashtable, str); printf("\n hashval = %d", hashval); /* Does item already exist? */ current_list = lookup_string(hashtable, str); if (current_list == NULL) { printf("\n DEBUG Purpose \n"); printf("\n Item not present. So, cannot be deleted \n"); return 1; } /* item exists, delete it. */ if (current_list != NULL) { struct list * temp = hashtable->table[hashval]; if(strcmp(temp->string,str) == 0) { if(temp->next == NULL) { hashtable->table[hashval] = NULL; free(temp); } else { hashtable->table[hashval] = temp->next; free(temp); } } else { struct list * temp1; while(temp->next != NULL) { temp1 = temp; if(strcmp(temp->string, str) == 0) { break; } else { temp = temp->next; } } if(temp->next == NULL) { temp1->next = NULL; free(temp); } else { temp1->next = temp->next; free(temp); } } } return 0; } void free_table(struct hash_table *hashtable) { int i; struct list *new_list, *temp_list; if (hashtable==NULL) return; /* Free the memory for every item in the table, including the * strings themselves. */ for(i=0; i<hashtable->size; i++) { new_list = hashtable->table[i]; while(new_list!=NULL) { temp_list = new_list; new_list = new_list->next; free(temp_list->string); free(temp_list); } } /* Free the table itself */ free(hashtable->table); free(hashtable); } void view_hashtable(struct hash_table * hashtable) { int i = 0; if(hashtable == NULL) return; for(i =0; i < hashtable->size; i++) { if((hashtable->table[i] == 0) || (strcmp(hashtable->table[i]->string, "*") == 0)) { continue; } printf(" Index : i = %d\t String = %s",i, hashtable->table[i]->string); struct list * temp = hashtable->table[i]->next; while(temp != NULL) { printf("\t %s",temp->string); temp = temp->next; } printf("\n"); } } int main() { hashtable = create_hash_table(10); if(hashtable == NULL) { printf("\n Memory allocation failure during creation of hash table \n"); return 0; } int flag = 1; while(flag) { int choice; printf("\n Press 1 to add an element to the hashtable\n"); printf("\n Press 2 to delete an element from the hashtable\n"); printf("\n Press 3 to search the hashtable\n"); printf("\n Press 4 to view the hashtable\n"); printf("\n Press 5 to exit \n"); printf("\n Please enter your choice: "); scanf("%d",&choice); if(choice == 5) flag = 0; else if(choice == 1) { char str[20]; printf("\n Please enter the string :"); scanf("%s",&str); int i; i = add_string(hashtable,str); if(i == 1) { printf("\n Memory allocation failure:Choice 1 \n"); return 0; } else if(i == 2) { printf("\n String already prsent in hash table : Couldnot add it again\n"); return 0; } else { printf("\n String added successfully \n"); } } else if(choice == 2) { int i; struct list * temp_list; char str[20]; printf("\n Please enter the string you want to delete :"); scanf("%s",&str); printf("\n String entered = %s", str); i = delete_string(hashtable,str); if(i == 0) { printf("\n Item found in list: Deletion success \n"); } else printf("\n Item found in list: Deletion failed \n"); } else if(choice == 3) { struct list * temp_list; char str[20]; printf("\n Please enter the string :"); scanf("%s",&str); temp_list = lookup_string(hashtable,str); if(!temp_list) { printf("\n Item not found in list: Deletion failed \n"); return 0; } printf("\n Item found: Present in Hash Table \n"); } else if(choice == 4) { view_hashtable(hashtable); } else if(choice == 5) { printf("\n Exiting ...."); return 0; } else printf("\n Invalid choice:"); }; free_table(hashtable); return 0; }

    Read the article

  • Reading audio with Extended Audio File Services (ExtAudioFileRead)

    - by Paperflyer
    I am working on understanding Core Audio, or rather: Extended Audio File Services Here, I want to use ExtAudioFileRead() to read some audio data from a file. This works fine as long as I use one single huge buffer to store my audio data (that is, one AudioBuffer). As soon as I use more than one AudioBuffer, ExtAudioFileRead() returns the error code -50 ("error in parameter list"). As far as I can figure out, this means that one of the arguments of ExtAudioFileRead() is wrong. Probably the audioBufferList. I can not use one huge buffer because then, dataByteSize would overflow its UInt32-integer range with huge files. Here is the code to create the audioBufferList: AudioBufferList *audioBufferList; audioBufferList = malloc(sizeof(AudioBufferList) + (numBuffers-1)*sizeof(AudioBuffer)); audioBufferList->mNumberBuffers = numBuffers; for (int bufferIdx = 0; bufferIdx<numBuffers; bufferIdx++ ) { audioBufferList->mBuffers[bufferIdx].mNumberChannels = numChannels; audioBufferList->mBuffers[bufferIdx].mDataByteSize = dataByteSize; audioBufferList->mBuffers[bufferIdx].mData = malloc(dataByteSize); } UInt32 numFrames = fileLengthInFrames; error = ExtAudioFileRead(extAudioFileRef, &numFrames, audioBufferList); Do you know what I am doing wrong here?

    Read the article

  • memcpy vs assignment in C

    - by SetJmp
    Under what circumstances should I expect memcpys to outperform assignments on modern INTEL/AMD hardware? I am using GCC 4.2.x on a 32 bit Intel platform (but am interested in 64 bit as well).

    Read the article

  • Immutability of structs

    - by Joan Venge
    I read it in lots of places including here that it's better to make structs as immutable. What's the reason behind this? I see lots of Microsoft-created structs that are mutable, like the ones in xna. Probably there are many more in the BCL. What are the pros and cons of not following this guideline?

    Read the article

  • Why are mutable structs evil?

    - by divo
    Following the discussions here on SO I already read several times the remark that mutable structs are evil (like in the answer to this question). What's the actual problem with mutability and structs?

    Read the article

  • How to sort an array of structs in ColdFusion

    - by Kip
    I have an array of structs in ColdFusion. I'd like to sort this array based on one of the attributes in the structs. How can I achieve this? I've found the StructSort function, but it takes a structure and I have an array. If this is not possible purely in ColdFusion, is it possible in Java somehow (maybe using Arrays.sort(Object[], Comparator))?

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >