Re: How to make c++ realize empty character constant ''?
Oh dear. Just as I went around to do some research, I've realised that what I'm actually talking about is ‘cc’ and not ‘cpp’, just mixed them up. (I couldn't understand, why we couldn't agree.) For quite while I use makefiles instead of the actual command and so this could easily slip my mind. That wasn't what I wanted to say anyways, I just wanted to point out, that g++ (or gcc) is just what it called in the GNU family, and on the Mac, Clang took it's place since Mavericks. With different tools from different vendors, it is called differently. But cpp still a C pre-compiler and we all can agree, that it is needed for MacPorts, otherwise neither cc nor c++ would work properly, right? I feel stupid now, and actually I wasn't needed here to begin with, so sorry for the commotion. ___ macports-users mailing list macports-users@lists.macosforge.org https://lists.macosforge.org/mailman/listinfo/macports-users
Re: How to make c++ realize empty character constant ''?
On Sat, Dec 14, 2013 at 6:21 AM, Juhász Ádám jad...@gmail.com wrote: But cpp still a C pre-compiler and we all can agree, that it is needed for MacPorts, otherwise neither cc nor c++ would work properly, right? It is included in both gcc and clang, and also included with Apple's clang. It just isn't the abusable one any more; it is a *C* preprocessor, not a Fortran preprocessor. And there is apparently an option to make clang's cpp more permissive, but it is no more recommended than gcc's -traditional for non-C use. (And I don't know if it is permissive enough to handle Fortran.) I should mention that I work with another non-C compiler that similarly abuses cpp --- and similarly broke with clang --- and am still trying to cut through the misunderstandings and politics involved in getting it replaced (we *have* a viable replacement already, just not the will to use it apparently). -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net ___ macports-users mailing list macports-users@lists.macosforge.org https://lists.macosforge.org/mailman/listinfo/macports-users
Re: How to make c++ realize empty character constant ''?
The *GNU's* C++ compiler name is g++. Clang's C++ compiler name is clang++ for example. (Microsoft Visual C++'s compiler name is lc.exe.) ‘c++’ usually a symlink on the compiler the system primarly built with. (or something like that.) the cpp (as a command) usually used to compile C codes, and it is heavily used by MacPorts (where the program was written in C) since MacPorts compiles the ports from source right there, on your Mac. One could use c++ (or g++) instead of cpp for C. However, the GNU compiler is also capable to select the proper language and use the proper tools for compillation, so GNU's cpp will compile… I believe Fortran, or even Java, if the proper alternative GNU compiler present. I've never used this capability this extremely though, and not aware wether other compilers are capable to do so. Xcode used to ship GNU's C++ compiler. Now it is only a symlink to clang++. 2013.12.13. 7:54 ezt írta (Davor Cubranic cubra...@stat.ubc.ca): C++ compiler's name is g++. Cpp is the macro preprocessor. (And what this has to do with MacPorts, I've no idea.) Davor On Dec 9, 2013, at 9:25 AM, Gmail yangz...@gmail.com wrote: Hi Chris Yes, it is fortran code. I am not sure why it uses CPP to compile it. From the compilation statement, Fortran code is converted to .b file and then to compile it. I am not sure why. On Dec 9, 2013, at 3:51 AM, Chris Jones jon...@hep.phy.cam.ac.uk wrote: If you're trying to make a C/C++ string, perhaps you want '\0'. But I can't tell what language you are working with or what exactly you are trying to accomplish. The code that was posted by the OP sure isn't C++... Been a while since I used it, but looks like fortran to me.. Thank you Bruce ___ macports-users mailing list macports-users@lists.macosforge.org https://lists.macosforge.org/mailman/listinfo/macports-users ___ macports-users mailing list macports-users@lists.macosforge.org https://lists.macosforge.org/mailman/listinfo/macports-users ___ macports-users mailing list macports-users@lists.macosforge.org https://lists.macosforge.org/mailman/listinfo/macports-users
Re: How to make c++ realize empty character constant ''?
On Fri, Dec 13, 2013 at 5:36 AM, Juhász Ádám jad...@gmail.com wrote: However, the GNU compiler is also capable to select the proper language and use the proper tools for compillation, so GNU's cpp will compile… I believe Fortran, or even Java, if the proper alternative GNU compiler present. I've never used this capability this extremely though, and not aware wether other compilers are capable to do so. Most people realized that abusing the *C* preprocessor for languages other than C/C++ was a mistake, some ten years ago when ANSI specified that the C preprocessor must actually understand the C language. The fact that GNU C still allowed it to sort-of work for other languages is something of a happy accident, not a natural law or an obligation on anyone's part. -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net ___ macports-users mailing list macports-users@lists.macosforge.org https://lists.macosforge.org/mailman/listinfo/macports-users
Re: How to make c++ realize empty character constant ''?
On Dec 13, 2013, at 2:36 AM, Juhász Ádám jad...@gmail.com wrote: the cpp (as a command) usually used to compile C codes, and it is heavily used by MacPorts (where the program was written in C) since MacPorts compiles the ports from source right there, on your Mac. One could use c++ (or g++) instead of cpp for C. This is utterly wrong: look at cpp’s man page, it’s a C *pre-processor*. It does no compilation whatsoever. Its sole function is to process the “#…” directives, such as splicing the #include”-d headers into the source file, removing parts of the source in the wrong arm of an “#ifdef”, or expanding #define”-d macros. However, the GNU compiler is also capable to select the proper language and use the proper tools for compillation, so GNU's cpp will compile… I believe Fortran, or even Java, if the proper alternative GNU compiler present. Not at all. Cpp is used automatically by the C compiler to deal with macros in the source file. It’s not intended to call the compiler itself, much less smart enough to choose the right compiler for the language. Davor ___ macports-users mailing list macports-users@lists.macosforge.org https://lists.macosforge.org/mailman/listinfo/macports-users
Re: How to make c++ realize empty character constant ''?
On Fri, Dec 13, 2013 at 5:36 AM, Juhász Ádám jad...@gmail.com wrote: However, the GNU compiler is also capable to select the proper language and use the proper tools for compillation, so GNU's cpp will compile… I believe Fortran, or even Java, if the proper alternative GNU compiler present. I've never used this capability this extremely though, and not aware wether other compilers are capable to do so. No, what's actually happening is that `-traditional` is being passed; this causes gcc and its cpp to behave like the old ATT Portable C Compiler that was available on older commercial Unix systems, so that it can compile pre-ANSI (sometimes called KR) C code. PCC's cpp was a straight textual substitution macro processor that did not understand the syntax of what it was substituting; ANSI C compilers cannot use that kind of macro processor. The -traditional option to gcc and its cpp exists only to support pre-ANSI (KR) C code. It happens to also be abusable (at least in its present form) to work with non-C languages, but not even the gcc developers advise this use. It is not reliable, it is not guaranteed to work with non-C code, and it is not guaranteed to be available even in future versions of gcc (there is not a lot of pre-ANSI C code around any more). -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net ___ macports-users mailing list macports-users@lists.macosforge.org https://lists.macosforge.org/mailman/listinfo/macports-users
Re: How to make c++ realize empty character constant ''?
If you're trying to make a C/C++ string, perhaps you want '\0'. But I can't tell what language you are working with or what exactly you are trying to accomplish. The code that was posted by the OP sure isn't C++... Been a while since I used it, but looks like fortran to me.. ___ macports-users mailing list macports-users@lists.macosforge.org https://lists.macosforge.org/mailman/listinfo/macports-users
Re: How to make c++ realize empty character constant ''?
It seems to me you are trying to assign a character value to a string. A character is a single 8-bit (or 9 or 10 or 16 or 32 ...) value. A string is a series of characters, terminated or not. Assuming you have the proper classes, you overloaded what needs to be, at best your assignment should look like frac_str = ; J. On Mon, Dec 9, 2013 at 4:51 AM, Chris Jones jon...@hep.phy.cam.ac.ukwrote: If you're trying to make a C/C++ string, perhaps you want '\0'. But I can't tell what language you are working with or what exactly you are trying to accomplish. The code that was posted by the OP sure isn't C++... Been a while since I used it, but looks like fortran to me.. ___ macports-users mailing list macports-users@lists.macosforge.org https://lists.macosforge.org/mailman/listinfo/macports-users -- Jean Gobin, Ing., CCENT, CCNA, CCNA Security http://newsfromjean.blogspot.com/ ___ macports-users mailing list macports-users@lists.macosforge.org https://lists.macosforge.org/mailman/listinfo/macports-users
Re: How to make c++ realize empty character constant ''?
On Sun, Dec 8, 2013 at 1:35 PM, Gmail yangz...@gmail.com wrote: I am trying to compile the following statements using CPP. This is a (formerly common) abuse of CPP and nobody can guarantee the result. I *very strongly* recommend you contact whoever provided whatever it is you are working with and get them to stop using cpp. The message you got was a warning, not an error. This warning can be suppressed (add parameters: -Wno-invalid-pp-token -Wno-unicode -Wno-trigraphs) but very little can be done if clang's cpp is producing output you don't expect. Worst case you can try making a gcc the user default compiler: sudo port install gcc48 sudo port select --set gcc mp-gcc48 and then find and run its cpp. I can't guarantee future versions of gcc will continue to work, though, as there is no guarantee whatsoever that cpp will work on things that are not C/C++. -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net ___ macports-users mailing list macports-users@lists.macosforge.org https://lists.macosforge.org/mailman/listinfo/macports-users
Re: How to make c++ realize empty character constant ''?
Hi Chris Yes, it is fortran code. I am not sure why it uses CPP to compile it. From the compilation statement, Fortran code is converted to .b file and then to compile it. I am not sure why. On Dec 9, 2013, at 3:51 AM, Chris Jones jon...@hep.phy.cam.ac.uk wrote: If you're trying to make a C/C++ string, perhaps you want '\0'. But I can't tell what language you are working with or what exactly you are trying to accomplish. The code that was posted by the OP sure isn't C++... Been a while since I used it, but looks like fortran to me.. Thank you Bruce ___ macports-users mailing list macports-users@lists.macosforge.org https://lists.macosforge.org/mailman/listinfo/macports-users
How to make c++ realize empty character constant ''?
Hi all I am trying to compile the following statements using CPP. IF ( denominator 0 ) THEN IF ( mod( numerator, denominator ) /= 0 ) THEN IF ( numerator 0 ) THEN WRITE(frac_str,FMT=('+',I2.2,'/',I2.2)) abs(numerator), denominator ELSE ! numerator 0 WRITE(frac_str,FMT=('-',I2.2,'/',I2.2)) abs(numerator), denominator ENDIF ELSE ! includes numerator == 0 case frac_str = '' ENDIF ELSE ! no-fraction case frac_str = '' ENDIF However the error is here cpp -C -P -xassembler-with-cpp -I/Users/bruce/Documents/A/model/WRFChem/WRFChem3_5_1/WRFV3/inc -I. -DEM_CORE=1 -DNMM_CORE=0 -DNMM_MAX_DIM=2600 -DCOAMPS_CORE=0 -DDA_CORE=0 -DEXP_CORE=0 -DIWORDSIZE=4 -DDWORDSIZE=8 -DRWORDSIZE=4 -DLWORDSIZE=4 -DNONSTANDARD_SYSTEM_SUBR -DMACOS -DWRF_USE_CLM -DNO_IEEE_MODULE -DDM_PARALLEL -DNETCDF -DUSE_ALLOCATABLES -DGRIB1 -DINTIO -DLIMIT_ARGS -DCONFIG_BUF_LEN=65536 -DMAX_DOMAINS_F=21 -DMAX_HISTORY=25 -DNMM_NEST=0 -traditional -C -P -I. Meat.b Meat.f Meat.b:869:18: warning: empty character constant [-Winvalid-pp-token] frac_str = '' ^ Meat.b:872:16: warning: empty character constant [-Winvalid-pp-token] frac_str = '' ^ 2 warnings generated. Does anyone know how to make cpp can compile empty character constant? Thanks in advance Bruce Thank you Bruce ___ macports-users mailing list macports-users@lists.macosforge.org https://lists.macosforge.org/mailman/listinfo/macports-users
Re: How to make c++ realize empty character constant ''?
On Sun, Dec 8, 2013 at 1:35 PM, Gmail yangz...@gmail.com wrote: Does anyone know how to make cpp can compile empty character constant? There is no such thing. What would it mean? If you're trying to make a C/C++ string, perhaps you want '\0'. But I can't tell what language you are working with or what exactly you are trying to accomplish. -- brandon s allbery kf8nh sine nomine associates allber...@gmail.com ballb...@sinenomine.net unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net ___ macports-users mailing list macports-users@lists.macosforge.org https://lists.macosforge.org/mailman/listinfo/macports-users