Oppolzer - Informatik / Blog


Blog-Hauptseite      Neuester Artikel      Älterer Artikel      Neuerer Artikel      Älterer gleiche Kategorie      Neuerer gleiche Kategorie

IBM-MAIN - Compiler-Option ROCONST für statische arrays

Subject:

Re: How declare in C++ a constant in an assembler module?

From:

Bernd Oppolzer <bernd.oppolzer@T-ONLINE.DE>

Reply-To:

IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU>

Date:

2014.11.18 11:47:39


IIRC, there is a compiler option ROCONST that deals with this,
but maybe only for ANSI C, not for C++.

If ROCONST is specified, static const variables will be placed
in STATIC CSECT, not in WSA, even if compiler option RENT
is specified (please look into the manuals for details).

We had problems with large static read-only arrays being allocated two times
(in STATIC as init pattern and once again in WSA, which lead to storage
problems).

Kind regards

Bernd


Am 18.11.2014 10:18, schrieb D.C:
> On 18/11/2014 1:07 PM, P.G. wrote:
>> On Mon, 17 Nov 2014 17:55:10 -0800, C.M. wrote:
>>
>>> Bingo! Thanks.
>>>
>> IIRC, the SAS/C compiler put them inline if declared "const";
>> in WSA otherwise.  I believe it does not violate ANSI C if an
>> object is declared "const" in one translation unit, with "const"
>> omitted in another, as long as it is not modified by the former.
>> Of course, this caused chaos with SAS/C.
>
> Hmm, and that's the problem with ANSI C (and C++). The standards can
> be interpreted in different ways which leads to inconsistent
> implementations. Throw into the mix the likes of Microsoft compilers
> violating the
> standard and you have the problem we have today with portability issues.
>
> IMO, static const should be inlined like C++ does but certainly not
> extern variables.
>
>> (BTDT)
>>
>>> -----Original Message-----
>>> From: D.C.
>>> Sent: Monday, November 17, 2014 5:38 PM
>>>
>>> The compiler wants to put all external variables into WSA. To turn
>>> that off
>>> specify norent.
>> -- gil
>>
>> ----------------------------------------------------------------------
>> For IBM-MAIN subscribe / signoff / archive access instructions,
>> send email to listserv@listserv.ua.edu with the message: INFO IBM-MAIN
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to listserv@listserv.ua.edu with the message: INFO IBM-MAIN
>

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to listserv@listserv.ua.edu with the message: INFO IBM-MAIN

Blog-Hauptseite      Neuester Artikel      Älterer Artikel      Neuerer Artikel      Älterer gleiche Kategorie      Neuerer gleiche Kategorie