I'm trying to port a program from gfortran to ifort (Intel Fortran Compiler 11). I'm stuck with two files that only compile with gfortran:
gfortran -x f77 -c daedrid.ff
gfortran -x f77-cpp-input -c daedris.ff
when I try to run intel fortran compiler with these files, I get:
ifort -fpp -c daedrid.ff
ifort: warning #10147: no action pe...
Hello,
how do i switch on an enum which have the flags attribute set (or more precisly is used for bit operations) ?
I want to be able to hit all cases in a switch that matches the values declared.
The problem is that if i have the following enum
[Flags()]public enum CheckType
{
Form = 1,
QueryString = 2,
TempData = 4,
}
and i ...
I have a number of flags defined (by a header file far outside my control) that look something like this:
*
* OPTVAL field for IPV6_ADDR_PREFERENCES_FLAGS
*
01 IPV6-ADDR-PREFERENCES-FLAGS PIC X(4).
*
* IPV6_ADDR_PREFERENCES_FLAGS mappings
*
77 IPV6-PREFER-SRC-HOME PIC X(4) VALUE X'00000001'.
77 IPV6-PRE...
I'm working with a large matrix (250x250x30 = 1,875,000 cells), and I'd like a way to set an arbitrary number of flags for each cell in this matrix, in some manner that's easy to use and reasonably space efficient.
My original plan was a 250x250x30 list array, where each element was something like: ["FLAG1","FLAG8","FLAG12"]. I then cha...
Hello folk,
I need to detect if a flag is set within an enum value, which type is marked with the Flag attribute.
Usually it is made like that:
(value & flag) == flag
But since I need to do this by generic (sometimes at runtime I event have only an "Enum" reference. I can not find an easy way to use the & operator. At the moment I m...
I am designing a database and was thinking about the need for a one to many relationship. Traditionally I have done the normal PK (as a GUID) and set up the relationship, but I was wondering instead if doing that why not use a bitwise flag as the PK.
The relationship would be lost but the data itself would describe the relationship.
E...
When you have a boolean option and a flag for setting it to false by prefixing "no" to the name, should it be "no" or "no_"? What's most commonly used or better style? For example:
--no_foo
or
--nofoo
...
Should the name of command line options for a program in a POSIX-style operating system be underscore-style, like
--cure_world_hunger
or maybe some other style?
--cureworldhunger
--cure-world-hunger
--cureWorldHunger
What's most common? What's better style? What's more Bash-friendly (if such a thing exist)?
...
On the file_put_contents() documentation, it says the following:
FILE_APPEND:
Mutually exclusive with LOCK_EX since
appends are atomic and thus there is
no reason to lock.
LOCK_EX:
Mutually exclusive with FILE_APPEND.
Yet, a couple of lines bellow I see the following code:
<?php
$file = 'people.txt';
// The new person t...
Is there a way to specify that a [Flags] enumeration field in a class should be serialized as the string representation (e.g. "Sunday,Tuesday") rather than the integer value (e.g. 5)?
To be more specific, when returning the following SomeClass type in a web service, I want to get a string field named "Days" but I'm getting a numeric fie...
Consider this:
[Flags]
enum Colors
{
Red=1,
Green=2,
Blue=4
}
Colors myColor=Colors.Red|Colors.Blue;
Currently, I'm doing it as follows:
int length=myColors.ToString().Split(new char[]{','}).Length;
But I hope there is a more efficient way of finding the length, maybe based on bitset operations.
Please, if possible, p...
Let's say I have this enum:
[Flags]
enum Letters
{
A = 1,
B = 2,
C = 4,
AB = A | B,
All = A | B | C,
}
To check if for example AB is set I can do this:
if((letter & Letters.AB) == Letters.AB)
Is there a simpler way to check if any of the flags of a combined flag constant are set than the following?
if((let...
Given a case where I have an object that may be in one or more true/false states, I've always been a little fuzzy on why programmers frequently use flags+bitmasks instead of just using several boolean values.
It's all over the .NET framework. Not sure if this is the best example, but the .NET framework has the following:
public enum...
If I wanted to represent states or options or something similar using binary "flags" so that I could pass them and store them to an object like OPTION1 | OPTION2 where OPTION1 is 0001 and OPTION2 is 0010, so that what gets passed is 0011, representing a mix of the options.
How would I do this in C++? I was thinking something like
enum ...
Hi,
I have a enum with a flagsattribute, which i use to represent permissions. I use it to compare if (CurrentPermissions & Permission1 == Permission1) etc...
[FlagsAttribute]
enum MyPermission
{
None = 0,
Permission1 = 1,
Permission2 = 2,
Permission3 = 4,
Permission4 = 8,...
..................
and so on
}
However, we r...
Hi,
I have a [Flags] enum like this:
[Flags]
public enum Status
{
None = 0,
Active = 1,
Inactive = 2,
Unknown = 4
}
A Status enum may contain two values such as:
Status s = Status.Active | Status.Unknown;
Now I need to create a linq query (LINQ to ADO.NET Entities) and ask for records whose status is s above, that is Acti...
I have created an ActiveRecord for a customer, and now they would like it so when it's destroyed, it is actually kept around for a manual rollback.
What I would like to do is create a boolean attribute called 'active', and it defaults to 1. When a record is destroyed, the attribute is toggled to 0.
I know I could change all my queries...
I have an Enum, suppose:
public enum ItemStatus {
Available, Unavailable
}
I have a method that returns a list of those TVs, based on a filter. And a filter is represented by an Enum:
[Flags]
public enum ItemStatusFilter {
Available = 1, Unavailable = 2
}
Question: what is a slick way to check if given instance of ItemStatu...
Hi,
on my ubuntu 9.04 the /usr/include/netinet/tcp.h defines the tcp header as follows
struct tcphdr
{
u_int16_t source;
u_int16_t dest;
u_int32_t seq;
u_int32_t ack_seq;
# if __BYTE_ORDER == __LITTLE_ENDIAN
u_int16_t res1:4;
u_int16_t doff:4;
u_int16_t fin:1;
u_int16_t syn:1;
u_int16_t rst:1;
...
So I may be pushing the boundaries just a bit...
Basically I have the following enum, declared in C# code:
[Flags]
public enum FlaggedEnum : int
{
Option1 = 1,
Option2 = 2,
Option3 = 4,
Option4 = 8,
...
Option16 = 32768,
None = 0
}
This enum is a member of an object which I have successfully bound to a Dat...