flags

Where to add -Wall and -Wextra in Xcode 3.1.4

妖精的绣舞 提交于 2019-12-05 15:49:48
I'm trying to figure out where to add extra warning flags like -Wall and -Wextra in Xcode, I'm using version 3.1.4 on Leopard. Apple's documentation is for an old version, if I follow their instructions it takes me to a completely different window than what they show. Also they have a screenshot of a checklist of specific warning flags, I can't figure out how to get to that or even if that's still around. CLARIFICATION: I'm building an iPhone app... bbum pointed me to the right spot for an OS X app, but the options are different for an iPhone project and I don't see an obvious analogue. In the

Combine Bitflags

允我心安 提交于 2019-12-05 09:56:13
I have several flags: None = 0 HR = 1 HD = 2, DT = 4, Fl = 8 .. etc I want to create a function where I input a certain flag, lets say : 6. Returned should be HDDT, since 2 | 4 = 6. It can also happen that 3 or more flags are combined or just a single one. e.g. : 7 = 1 | 2 | 4 => HRHDDT. How can I return the concated string depending on the flag value? In my case the enum has many more entries, which would make a simple if statement really uncomfortable, because I would have to cover hundreds of cases. Is there any clever solution to this? You can store the flags as a dict like so: flags = {1:

Read flag register from C program

╄→尐↘猪︶ㄣ 提交于 2019-12-05 07:55:07
For the sake of curiosity I'm trying to read the flag register and print it out in a nice way. I've tried reading it using gcc's asm keyword, but i can't get it to work. Any hints how to do it? I'm running a Intel Core 2 Duo and Mac OS X. The following code is what I have. I hoped it would tell me if an overflow happened: #include <stdio.h> int main (void){ int a=10, b=0, bold=0; printf("%d\n",b); while(1){ a++; __asm__ ("pushf\n\t" "movl 4(%%esp), %%eax\n\t" "movl %%eax , %0\n\t" :"=r"(b) : :"%eax" ); if(b!=bold){ printf("register changed \n %d\t to\t %d",bold , b); } bold = b; } } This gives

Multiple ways to define C# Enums with [Flags] attribute?

自闭症网瘾萝莉.ら 提交于 2019-12-05 07:54:07
I understand how Enums work in C#, and I get what the Flags attribute brings to the table. I saw this question, here . Which recommends the first flavor, but doesn't provide any reason/justification for it. Is there a difference in the way in which these two are defined, is one better than the other? What are the advantages to using the first synax as instead of the second? I've always used the second flavor when defining Flags type Enums... have I been doing it wrong all this time? [Serializable] [Flags] public enum SiteRoles { User = 1 << 0, Admin = 1 << 1, Helpdesk = 1 << 2 } Is that not

How do I use low-level 8 bit flags as conditionals?

微笑、不失礼 提交于 2019-12-05 07:47:10
In my keyboard hook, each keypress gets a flag that states if it was injected or not. http://msdn.microsoft.com/en-us/library/ms644967(VS.85).aspx I've distilled a KBDLLHOOKSTRUCT from the lParam. I can access kbd.flags.XXX. I just don't know how to convert this 8bit flag into an if (injected) {... type conditional that I know how to use. If one of you smart computer-science types would help me out I'd really appreciate it. private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam) { KBDLLHOOKSTRUCT kbd = new KBDLLHOOKSTRUCT(); Marshal.PtrToStructure(lParam, kbd); //if

Naming convention for posix flags

送分小仙女□ 提交于 2019-12-05 07:28:43
问题 I'm writing a console application which allows several Posix flags to be set. This is what I'm using currently. Words in the flags are concatenated with a dash: -p, --broker-port int Broker Port (default 1883) -u, --broker-url string Broker URL (default "localhost") -c, --client-id string MQTT Client Id -r, --room string Room where sensor is located (default "myroom") -f, --floor string Floor, where room is located (default "basement") However I have also seen applications using CamelCase to

Storing binary string in MySQL

筅森魡賤 提交于 2019-12-05 06:45:00
I've developed a small binary flag system for our admin centre. It allows us to set items to have multiple options assigned to them, without having to store have a table with several fields. Once the options are converted into binary with bitwise operators, we'd end up with an option like 10000 or 10010 which is all good. Doing it this way allows us to keep adding options, but without having to re-write which value is which, 10010 & (1 << 4) and I know that we have something turned on. The problem however is storing this data in our MySQL table. I've tried several field types, but none of them

C# Enums - Check Flags against a Mask

你。 提交于 2019-12-05 04:18:50
I have the following enum flags: [Flags] private enum MemoryProtection: uint { None = 0x000, NoAccess = 0x001, ReadOnly = 0x002, ReadWrite = 0x004, WriteCopy = 0x008, Execute = 0x010, ExecuteRead = 0x020, ExecuteReadWrite = 0x040, ExecuteWriteCopy = 0x080, Guard = 0x100, NoCache = 0x200, WriteCombine = 0x400, Readable = (ReadOnly | ReadWrite | ExecuteRead | ExecuteReadWrite), Writable = (ReadWrite | WriteCopy | ExecuteReadWrite | ExecuteWriteCopy) } Now i have an enum instance that I need to check if it's readable. If I use the following code: myMemoryProtection.HasFlag(MemoryProtection

What is the use of flags in Parcelable?

一笑奈何 提交于 2019-12-05 00:20:19
I have been writing Parcelable s to Parcel without any focus on flags field, which is a parameter in the method signature and it has worked fine but I have run into an implementation where I can no longer ignore them: public static <K extends Parcelable, V extends Parcelable> void write(Parcel dest, Map<K, V> map, int flags) { if (map == null) { dest.writeInt(-1); } else { Set<Map.Entry<K, V>> entrySet = map.entrySet(); dest.writeInt(entrySet.size()); for (Map.Entry<K, V> entry : entrySet) { dest.writeParcelable(entry.getKey(), flags); dest.writeParcelable(entry.getValue(), flags); } } } This

How to allow -z multidefs with g++47

牧云@^-^@ 提交于 2019-12-04 20:05:49
How can I tell the linker of g++ to allow multiple definitions of symbols (choose the first appearance)? -z multidefs Allows multiple symbol definitions. By default, multiple symbol definitions occurring between relocatable objects (.o files) will result in a fatal error condition. This option suppresses the error condition and allows the first symbol definition to be taken. This option is valid only when the -b svr4 option is specified. The -zmuldefs option is not recognized by g++ , nor -z OPTION . What's the correct parameter? Is it possible? There is no such thing as the "linker of g++",