How to disable WAL journal mode

To disable WAL mode, set the journal_mode to DELETE NSMutableDictionary *pragmaOptions = [NSMutableDictionary dictionary]; [pragmaOptions setObject:@”DELETE” forKey:@”journal_mode”]; NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], NSMigratePersistentStoresAutomaticallyOption, [NSNumber numberWithBool:YES], NSInferMappingModelAutomaticallyOption, pragmaOptions, NSSQLitePragmasOption, nil]; [_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:options error:&error]

Is using #pragma warning push/pop the right way to temporarily alter warning level?

This will work with multiple compilers (and different versions of compilers). Header “push” #if defined(__clang__) # pragma clang diagnostic push #endif #if defined(_MSC_VER) # pragma warning(push) #endif #if defined(YOUR_FAVORITE_COMPILER) # pragma your compiler push warning #endif Header “pop” #if defined(__clang__) # pragma clang diagnostic pop #endif #if defined(_MSC_VER) # pragma warning(pop) #endif Some warning #if … Read more

What does “#pragma comment” mean?

#pragma comment is a compiler directive which indicates Visual C++ to leave a comment in the generated object file. The comment can then be read by the linker when it processes object files. #pragma comment(lib, libname) tells the linker to add the ‘libname’ library to the list of library dependencies, as if you had added … Read more

Use of #pragma in C

#pragma is for compiler directives that are machine-specific or operating-system-specific, i.e. it tells the compiler to do something, set some option, take some action, override some default, etc. that may or may not apply to all machines and operating systems. See msdn for more info.

Tell gcc to specifically unroll a loop

GCC gives you a few different ways of handling this: Use #pragma directives, like #pragma GCC optimize (“string”…), as seen in the GCC docs. Note that the pragma makes the optimizations global for the remaining functions. If you used #pragma push_options and pop_options macros cleverly, you could probably define this around just one function like … Read more