clang

Generate .c source from a .m (Objective-C) file

旧时模样 提交于 2020-01-06 08:48:13
问题 Is it possible to generate a C source file (.c) from an Objective-C source file (.m), using, maybe, GCC or Clang (or another tool)? 回答1: No, but you may be interested in the C++ rewriter. Given an objective-C file, let's say: #import <stdio.h> int main() { void (^blk)(void) = ^{ printf("hi"); }; blk(); return 0; } You can get a C++ version with clang -rewrite-objc main.c which is great to see how objective-C is implemented. Most of the file will be just C. Some of the resulting expressions

g++ can't override exit function

我是研究僧i 提交于 2020-01-06 07:10:35
问题 I have a c++ program where I want to compile out std::exit and use my own, i.e. via: -Dexit=myExit However, I run into this issue: In file included from /usr/include/c++/7/ext/string_conversions.h:41:0, from /usr/include/c++/7/bits/basic_string.h:6352, from /usr/include/c++/7/string:52, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/istream:38, from /usr/include/c++/7/sstream:38, from tests

Why is prefix incrementation (++x) faster than postfix incrementation (x++) in C? [duplicate]

吃可爱长大的小学妹 提交于 2020-01-06 06:55:12
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Is there a performance difference between i++ and ++i in C? I heard it said that prefix incrementation is faster than postfix incrementation in C. Is this true and why? ++x vs x++ 回答1: This is a ridiculous myth that gets repeated over and over. The two operators have semantic differences; one has as its result the old value and the other has as the result its new value. If you use this result, the code will have

Why is prefix incrementation (++x) faster than postfix incrementation (x++) in C? [duplicate]

二次信任 提交于 2020-01-06 06:55:07
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Is there a performance difference between i++ and ++i in C? I heard it said that prefix incrementation is faster than postfix incrementation in C. Is this true and why? ++x vs x++ 回答1: This is a ridiculous myth that gets repeated over and over. The two operators have semantic differences; one has as its result the old value and the other has as the result its new value. If you use this result, the code will have

Why do I get a linker error while I try to compile a C file?

…衆ロ難τιáo~ 提交于 2020-01-06 05:25:13
问题 I've had this error for weeks I already made a post about it but it wasn't very clear. So I am calling a function from a a header file myBmpGris.h and the functions are implemented on the file myBmpGris.c . Here is my main file: #include<stdio.h> #include<stdlib.h> #include "myBmpGris.h" int main(){ char * image_name = "image_carre.bmp"; BmpImg image = readBmpImage(image_name); return 0; I compile by using ggc main.c and I get this error message : Undefined symbols for architecture x86_64: "

LLVM IR: expose variables to GDB?

你离开我真会死。 提交于 2020-01-05 17:51:38
问题 I am writing a custom programming language. I am generating LLVM IR as an intermediate (via LLVMlite), and I want to expose variables to GDB. This is an example of the generated IR: ; ModuleID = "tests/debuginfo.xan" source_filename = "debuginfo.xan" target triple = "x86_64-unknown-linux-gnu" target datalayout = "" define void @"main"(i32 %".1", i8** %".2") !dbg !10 { entry: %"$argc" = alloca i32 store i32 %".1", i32* %"$argc" %"$argv" = alloca i8** store i8** %".2", i8*** %"$argv" %"$a" =

LLDB: Must I build it from source (XCode project) to use it from the command line?

大城市里の小女人 提交于 2020-01-05 09:52:29
问题 XCode comes with LLDB, presumably there is a way to enable it as the debugger to use when debugging XCode projects. Of course being a Linux user I have become a hardcore command-line fanatic and I have a well-established Vim and Tmux workflow. Also being a code portability freak, 100% of my scripts work on both OS X and Linux. So is there some sort of way to "Pull out" the LLDB from deep within the bowels of XCode and run it from the command line? What are the benefits of compiling it

C : Warning about visibility of a struct

走远了吗. 提交于 2020-01-05 08:24:22
问题 I have a complex C project. In a file message.h I declare this structure struct message { int err; struct header { char *protocol_version; char *type; long int sequence_number; } header; struct body { int num_tag; char *tag_labels[LEN]; int num_attr_tag[LEN]; char *attr_labels[LEN][LEN]; char *attr_values[LEN][LEN]; char *attr_types[LEN][LEN]; } body; }; In the file "castfunctions.h", I include the file "message.h" and I declare the function "setClientNat" #include <message.h> void

framework not found -fobjc-arc

你。 提交于 2020-01-05 06:03:38
问题 I installed Spark Inspector to see what it was like. I don't know for certain but I think it caused a problem with cocoapods. I'm in the middle of trying to remove them both. I've fixed most things but I'm not getting a build error of... framework not found -fobjc-arc I'm not sure where to start with this as I can't find a framework called this and I've never seen this error before. Can someone point me in the right direction please. 回答1: Robert Harvey's comment got me looking in the right

framework not found -fobjc-arc

半世苍凉 提交于 2020-01-05 06:03:18
问题 I installed Spark Inspector to see what it was like. I don't know for certain but I think it caused a problem with cocoapods. I'm in the middle of trying to remove them both. I've fixed most things but I'm not getting a build error of... framework not found -fobjc-arc I'm not sure where to start with this as I can't find a framework called this and I've never seen this error before. Can someone point me in the right direction please. 回答1: Robert Harvey's comment got me looking in the right