Difference between 12.4 & gcc/clang w/regard to anonymous structs in unions

I'm actually reporting two differences, but subjects can only be so long.
union Blah {
  struct {
    unsigned char x[8];
  };  // Sun Studio error: A declaration does not specify a tag or an identifier
      // note: -features=extensions is required to get this to compile
  unsigned int y[2];
  void SwapBytes() {
    for( int ii = 0; /*...*/ ) {
      x[ii] = /*...*/;  // Sun Studio error: x is not defined
int main( int argc, char *argv[] ) {
  Blah b = { 0xDEADBEEF, 0xBADBABE0 };  // clang/gcc warn that this is a narrowing conversion because the
                                        // default behavior for brace initialization is to initialize according
                                        // to the first type found in the union.
                                        // Sun Studio only warns with +w2, and only reports the more opaque msg:
                                        //   Warning: partially bracketed initialization for b
  return 0;
There are two problems reported here:
gcc/clang allow the anonymous struct -- it's useful for preventing access to the array of bytes but allowing union member functions access to it
difference in when/why the bracketed initialization produces a warning
-Brian

First, a correction. The Studio 12.4 compiler allows anonymous structs by default, unlike earlier compilers. Apparently we decided to step to the other side of this line. :-) The compiler does issue a warning for the non-standard code.
The narrowing conversions in the example
Blah b = { 0xDEADBEEF, 0xBADBABE0 };
are errors in C++11, not warnings. In the C++11 standard, refer to section 8.5.4 List-initialization. This rule is a change from the previous C++ standard, one of a very small number of cases where valid code becomes invalid.
Not all narrowing conversions are errors, only narrowing conversions in initializer-lists. You can make the code valid by inserting an explicit cast.

Similar Messages

  • Difference between VS2013 and GCC debug symbols

    Hi guys,
    I am writing you today as I am having trouble with my software. it has a Windows and a Linux version, each of them respectively using a static library (C++).
    I notice that, if I build my Windows static library as RELEASE without any debug info : /O2, and Debug Information Format -> None and manually removed.pdb, the .lib file size about 40mb.
    On the contrary, regarding the Linux library, I use GCC in order to build it as RELEASE as well: -O2 and -g0.
    Once compiled, my .a file's size is about 12mb.
    Well, those compilers are completely different, and the library's size doesn't really matter.
    Of course, my application, which needs the library, has debug symbols generated (whether I am on Windows or Linux).
    While debugging, I can have access to all of the members/classes of my application (and also the ones from my Windows library), using Microsoft Visual Studio 2013.
    And now, while debugging with the Linux lib (within Eclipse), I have access to my class members, except the one from the library.
    I was wondering what's happening in the background:
    _ Why does it seem like the Windows version of my library contains more symbols/data, which allows me to debug my program using the library ?
    _ Why can't I debug the objects from my Linux library ? (this one is about four times smaller than the Window's one)
    If I try to access to some classes from my library, Eclipse/GDB says <incomplete type> in the Debug view.
    I am lost on this point. Does anyone know about that ?
    Thank you very much for your help !

    Hi ddocteur,
    Appreciate your patience and sharing detailed information. 
    It does need to cost some time to to involve someone familiar with this topic to further look at this issue. Your detailed information will be quite helpful, and there might be some time delay.
    Thanks for your sharing and understanding.
    Best Regards,
    Carl
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • What's the difference between g++ and gcc?

    For the hello.cc:
    #include <iostream.h>
    int main()
    cout << "Hello";
    return 0;
    I can compile it with g++, and it works.
    but with gcc, when
    #gcc -o hello hello.cc
    there are some errors, the errors are:
    Undefined first referenced
    symbol in file
    cout /var/tmp/cceeiWHM.o
    ostream operator<<(char *) /var/tmp/cceeiWHM.o
    I think I should setup some lib path for gcc, because it can compile, but failed in linking.
    Thanks
    Len

    iMovie enables you to edit video footage - typically from a video camera - add titles, effects, etc.
    iDVD enables you to create an authored DVD of your iMovie, complete with DVD menu, chapters, "extras", etc and can be played in a conventional DVD player.
    20" iMac Intel Core Duo 2GHz 1GB RAM   Mac OS X (10.4.7)  

  • Difference between MBBS and MB5L report.

    All capital inventory till FY-2008-09 was transferred to revenue inventory by movemnt typr 411-Q in MB1B.All the codes those were transferrd are now appearing in MBBS but with zero value. However these codes are appearing in MB5L with value under GL 132006 (for capital items) and having value of 1.08 crores (0.94 crore for imported items and 0.14 crore for revenue items). The GL for all these codes neds to be changed to 132000 (revenue inventory GL) so that in MB5L also these items appear as revenue items.As of today GL of all the codes appearing under GL 132006 are to be changed to 132000 except code 496700086.
    now, changes are reflected in report MBBS but not showing correct information in MB5L report..
    Please guide what is the difference between MBBS and MB5L report.
    Regards
    SHreya

    Hi,
    MBBS gives stock values of "project'" and "sales order" only.
    MB5L gives total stock value .

  • What are the major differences between 4.7 and ecc5.0

    hi all
    What are the major differences between 4.7 and ecc5.0
    regards
    JK Rao

    Hi,
    Good morning and greetings,
    Please use the following link
    http://solutionbrowser.erp.sap.fmpmedia.com
    Please reward points if found useful
    Thanking you
    With kindest regards
    Ramesh Padmanabhan

  • What is the difference between logical ROWID and physical ROWID

    hello
    can u please explain the difference between logical ROWID and physical ROWID
    regards,

    from the docs (a 30 sec search)
    Physical rowids store the addresses of rows in ordinary tables (excluding index-organized tables), clustered tables, table partitions and subpartitions, indexes, and index partitions and subpartitions.
    Logical rowids store the addresses of rows in index-organized tables.

  • Difference between  business area and profit center

    hi all
    could you please tell me about difference between business area and
    profitcenter.
    thanks,
    regards,
    chennuri.

    HI
    Read below
    Profit Center - The profit center view shows the various
    internal areas of responsibilities. Objects such as cost
    centers, materials, etc can be used for profit center
    analysis. Profit center can be used to determine the
    revenues, costs, and profitability for specfic areas of
    responsibility.
    Business Area - Business area forms an important part of
    external reporting. Analysis of various segments, product
    divisions, regions etc is possible using business areas.
    Business Area: This is optional
    This can be used cross compane codes
    This is for Internal Purpose
    It is not Legal Entity like Co Code
    The transation entered in Business are, Debit total will
    not tally with credit total
    Since it is used for segment wise or area wise or line wise
    this is used for internal report purpose only .
    Balance Shhet and P & L stataments can be drawn on segment
    wise
    Profit Centre: Generally in terms of SAP or Finance the
    meaning of Profit centre is to know the profitabilty.
    In same manner , The managers  wants to know the ROI from
    their investments, obviously we nned to use the tool.
    This ROI may be geographically or area wise or division
    wise. P.C provided us profitablity of the particular area
    for internal purpose ( Only for Internal )
    Business Area is an optional entry.Whenever company wants
    financial statements businessarea wise we can maintain
    BAs.And also we can maintain BA as Segment Wise,Product
    Wise,Geographical Location wise.
    Profit center is used to know the profits of companies.PC
    is also used for to know the profits as aProduct
    wise,Segment wise,geographical location wise.If anything
    wrong inthis answer plz correct me..
    Hope this helps
    Good Luck
    Hari

  • Differences between AIX and Windows for SAP

    Dear All,
    I have a problem regarding SAP Software.We want to change our company software .First we order SAP On Windows with Oracle10g But Now We want SAP on AIX with Oracle10g.
    SAP delivered us software on Windows platform.
    Please Suggest me for this as what are the differences between the above two platforms and what are the differences between the above 2 platforms.
    Regards,
    Pankaj Kalsayan

    hi Pankaj,
    well, this is a very general question. perhaps you could specify a little more.
    in general i would see no difference regarding the end user sitting in front of his pc using sapgui.
    as far as i know all server side sap software is available for aix and windows (and many more).
    for administration on the other hand there is of course lots of difference. AIX is a UNIX operating system running on special hardware with power processors. it offers quit extensive virtualisation abilities using so called LPARs and supports real big number of CPUs and large RAM. Windows is a completly differnet operating system running mostly on x86/amd64 hardware.
    therefore you should also consider what know-how is available in your system administration.
    not shure if that is partly answering your question ...
    btw. if you are going forward with AIX you should perhaps consider switching oracle with db2. so you have a consistent IBM based landscape. also to me, sap and db2 seem to "like" each other more than sap and oracle
    regards,
    martin

  • Difference between Thin Drivers and Thick Drivers

    hi all,
    can any one tell me the difference between Thin Drivers and Thick Drivers.
    regards
    ravi

    OCI is Oracle Call Interface. That's the lowest-level client API Oracle offers and the API that every thick client application eventually uses. For example, a C++ application using ADO would use the OLE DB driver which is itself written in OCI.
    From a deployment standpoint, the major difference is that the thin driver can be deployed to any machine that has Java installed. The OCI driver can only be deployed to machines that have the Oracle client installed.
    From a performance & functionality standpoint, there are features that only the OCI driver provides. Depending on the application, the OCI driver may also be faster.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Difference between Reaport Painter and Report Writer

    HI All,
    What is the Difference between Report painter and Report Writer
    regards
    JK

    Hi
    Report Painter allows the user to report on data from various applications using graphical report structure which forms the basis for report.
    Report Writer allows the user to report on data from multiple applications using functions such as sets, variables, formulas, cells, key figures and the user can create more complex reports as per clients requirements.

  • What is the difference between private API and public API??

    Hi,
    I came accross the terms private API and Public API ?
    what are these APIs and what is the difference between them??
    Thanks and Regards,
    Soham

    Soham,
    Publicly Callable Business Process APIs are the list of supported and published APIs. Direct calls to any other routines are not supported, unless explicitly specified, because API validation and logic steps will be bypassed. Many other packages include procedures and functions, which may be called from the API code itself.
    Note:216838.1 - Oracle HRMS Product Family Publicly Callable Business Process APIs (A Reference Consolidation)
    Regards,
    Greg

  • Difference between SCM, SEM and SRM

    Hi
    Can anyone help me to understand the difference between SCM, SEM and SRM ?
    Regards
    Srini

    SRM is a procurement tool like ARIBA .
    SRM is a web based tool to handle all procurement business process .
    to know more about SRM . here you go..
    http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=18926
    SAP SRM will help you move beyond spend reduction to gaining competitive advantage and supporting top-line growth. The application enables purchasing excellence, increases profitability, and helps transform sourcing and procurement practices and create new business opportunities - all of which translates into a measurable ROI. SAP SRM enables the full range of supply and procurement activities, closing the loop from strategy stage to execution. SAP SRM will help you optimize operations and put together a world-class supply and procurement operation, with a scalable platform and an easy-to-use business user interface that enables processes in the following key areas:
    Spend analytics
    Supplier performance management
    Strategic sourcing
    Contract management
    Operational procurement
    Catalog management

  • Difference between JSTL and JSF

    Hi
    I am little bit confuse between JSTL and JSF. can one tell me what is difference between JSTL and JSF ?
    Thanks & regards,
    Ben

    from suns site
    The JavaServer Pages Standard Tag Library (JSTL) encapsulates as simple tags the core functionality common to many Web applications. JSTL has support for common, structural tasks such as iteration and conditionals, tags for manipulating XML documents, internationalization tags, and SQL tags.
    http://java.sun.com/javaee/javaserverfaces/overview.html

  • Difference between message type and idoc type

    Hi
    difference between message type and idoc type
    Regards
    Rama

    Hi,
    Message Type:
    A message type represents the application message exchanged between R/3 systems and R/3 and an external system. A message type characterises the data sent across systems and relates to the structure of the data called an IDOC type.
    Diff. with IDOC type
    An IDoc type specifies the structure of the data.
    A message type specifies the meaning of the data
    Diff. b/w IDOC type and IDOC
    An IDoc type is the definition of a specific data structure.
    An IDoc is an actual instance of data based on an IDoc type. Therefore, there can be many IDocs created from a single IDoc type.
    Example:
    MATMAS is the message type and MATMAS05 is IDoc type for Material Master.
    Thanks,
    Shankar

  • Difference between TKOMV and XKOMV.

    Hallo All,
    Can anyone please tell me difference between TKOMV and XKOMV.
    Thanks & regards,
    Cheruku.

    hi raymond,
    I want to move tkomv-mwsk1 value into vbap and vbak databse tables. If i do it using Xkomv like
    * include mv45afzz
    FORM USEREXIT_MOVE_FIELD_TO_VBAK.
    vbak-zz_mwsk1 = XKOMV-mwsk1
    endform.
    it is working
    but when i keep tkomv it is showing error there is no tkomv.
    vbak-zz_mwsk1 = tKOMV-mwsk1 (not working).
    error:
    Field "TKOMV-MWSK1" is unknown. It is neither in one of the specified 
    tables nor defined by a "DATA" statement. "DATA" statement. 

Maybe you are looking for