As you've mentioned I've seen pragmas in visual c++ which tell it to link to a certain library during link time. Handy for a library which needs winsock libs. This way you don't need to modify the project settings to get it linked it. ex: #pragma comment(lib,"wsock32.lib")
. I like this because it associates the code that needs the .lib with it, plus once you put that in the file, you can't forget it if you reuse that code in another project.
Also, pragmas for packing of data structures are often useful, pareticually with systems and network programming where the offsets of data members matter. ex:
#pragma pack(push, 1) // packing is now 1
struct T {
char a;
int b;
};
#pragma pack(pop) // packing is back to what it was
// sizeof(T) == sizeof(char) + sizeof(int), normally there would be padding between a and b